Question

I've had a couple different versions of Visual studio installed on my machine over the past 2 years. As of last week, I had VS2012, VS2010 and VS2010 express edition. This morning, I uninstalled the express edition (since I have the complete version). However, when I went to develop in 2010, I had all kinds of issues with not being able to include iostream.

I tested it in VS2012 and it ran just fine, but for some reason, copying the include folder from VS2012 to VS2010 didn't work. I need to be able to develop in 2010 to utilize a library that for whatever reason doesn't work well with 2012 yet.

As I mentioned, I tried copying the include directory that worked, but I got other errors. I also tried repairing the installation, but that also didn't work.

Here is a code sample that generates the error message:

    #include <iostream>
    using namespace std;
    int main()
    {
        cout<<"hello world"<<endl;
    }

And the error:

fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1>
1>Build FAILED.

Any fixes that don't involve me either re-installing windows or having to completely uninstall VS2010?

Was it helpful?

Solution

Removing a version of VS2010 with another one installed tends to result in the standard library files being removed as well. This is an issue because these are shared by all installed versions of Visual Studio 2010.

The solution is simply to uninstall the ordinary Visual Studio 2010 and then reinstall it. This will lead to the headers being properly installed again.

The reason you cannot simply use the VS2012 headers is that they use a lot of C++11 features and other internal Microsoft code which is not compatible with older versions of Visual Studio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top