I am using visual studio 2010. I wanted to compile my cpp from cmd. I can compile it using "cl file.cpp" comand in visual studio developer command line tool.

But I wanted to compile it from the built in cmd of windows. When I try to use the command "cl file.cpp" it does not recognize the command. I even tried to cd to cl.exe path and run from there but then it gives a mspdb110.dll is missing error.

I herd that we need to put environment variables but I am not able to find anywhere which variables to set.

4 Years
Discussion Span
Last Post by eagle_phoenix2

You probably need to add your library directories to your PATH variable in the enviroment-settings. Why do you want to this if I may ask?


Visual studio comes with a command prompt application to replace the cmd.exe from Windows. That visual studio command prompt is basically the same as the cmd.exe except that it initializes all the necessary environment variables when it is started. I see no reason not to use it since it doesn't require you to launch Visual Studio and it is basically the same tool as cmd.exe (which is a shit command prompt program anyways). You also might want to look at Windows Powershell (it's free) which replaces cmd.exe with a much more powerful (more Unix-like) shell application (it has things like pipes, regular expressions, folder stacks, etc., which actually make it a useful shell, as opposed to cmd.exe which is complete crap).

Otherwise, you can use a batch file that comes with MSVC which sets up all the required environment variables. See the instructions here. You just have to run this batch file each time you start the command-prompt (which is basically what the Visual Studio command prompt does, but automatically).


I am trying to configure pc2. A software used in ACM competitions. It has a auto evaluation feature, which compiles and runs the submited programs on auto. I was trying to configure pc2 such that it uses visual studio compiler.
In order to use the compiler from command line I need to set the variables. As running the varsall.bat file or vcvars32.bat file only sets variables for the cmd window in which it was called hence the pc2 shell is not able to compile using visual studio as it does not recognize "cl" command.
Therefore I need to know the variables it sets or atleast make it such that running the auto setting files makes cl command recognized on all the cmd windows.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.