Claudiu Epure
Claudiu Epure

Reputation: 51

I can't include <iostream> in Visual C++ 2010 Express Edition

Few months ago I installed Visual Studio 2012 Ultimate. Beacuse of some school projects, I had to install Visual C++ 2010 Express Edition. Now, when I try to compile a project in Visual C++ 2010, I cannot include any usual header like <iostream>, <cmath>, etc. The folder the compiler searches is C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include.

But all these include files are located in C:\Program Files\Microsoft Visual Studio 11.0\VC\include.

Can someone please explain me what is about with these two paths (what are the differences) and how to solve the #include <iostream> problem.

Upvotes: 2

Views: 3783

Answers (2)

user2866763
user2866763

Reputation: 11

I got the same problem. A fresh Windows and VC++ 2010 Express install on a virtual machine solved the problem.

Upvotes: 0

Emre Dirican
Emre Dirican

Reputation: 397

From the details you share, I understand that /Microsoft Visual Studio 10.0/VC/include directory doesn't contain the standard header files.

The include directory $(VCInstallDir) in VS 2010 is probably pointing at /Microsoft Visual Studio 10.0/VC. Since, the include folder is empty you don't get to compile your code.

As far as I know, this problem occurs when people install VS2012 and 2010 afterwards. My guess some problem occurs with registries and VS2010 Setup doesn't install header files properly.

You might have 4 options:

  1. Using Visual Studio Tools->Visual Studio Command Prompt, change the $(VCInstallDir) such that it points to "/Visual Studio 11.0/include"

  2. If you know someone who has VS2010(same edition as yours) working properly, copy their "/VC/include" directory to yours.

  3. Uninstall both VS2012 and VS2010 ( full uninstall as described here: http://archive.msdn.microsoft.com/vs2010uninstall) Clean the registries and install VS2010 again.

  4. Make a fresh Windows installation and install VS2010 afterwards.

Sadly only option 4 worked in my case. Option 2 worked too, but I got other problems in another project. Good luck.

Upvotes: 2

Related Questions