Visual Studio Command Prompt (2010) can't find paths / includes

Nate picture Nate · Sep 6, 2011 · Viewed 8.8k times · Source

I am trying to use this tutorial from MS to verify I can build a .cpp file from the command line on my system. I seem to be having problems with my VS Command Prompt. It cannot find cl.exe or the needed include files. I added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin and C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE to my path so it would find cl.exe. Now my error is:

test.cpp(1) : fatal error C1034: iostream: no include path set

Isn't the whole point of the VS Command Prompt to setup all these environment vars for me? Why isn't it setting it up properly?

Answer

Conrad Frix picture Conrad Frix · Sep 7, 2011

I'm not sure exactly what your problem is but you might want to do the following to help determine the actual cause.

You may have noticed that the VS command prompt shortcut is a bat file. The first line is

@echo off

Change it to

REM @echo off

Run it again and see if you get any errors. If you don't it may be in one of the processor specific batch files to know which one that is look for the call to other batch like this.

C:\Program Files\Microsoft Visual Studio 10.0\VC>call "C:\Program Files\Microsof
t Visual Studio 10.0\VC\bin\vcvars32.bat"
Setting environment for using Microsoft Visual Studio 2010 x86 tools.

Again REM out the @echo off in the batch and then run it again and see what errors you get.

Update from comment

The error ERROR: Cannot determine the location of the VS Common Tools folder means your missing the Environment Variable %VS100COMNTOOLS% which is usually set to "c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\"

You can simply add it back using system properties -> Advanced -> New (under system variables)

See this superuser question for more on environment variables