fatal error C1083: Cannot open include file: 'iostream': No such file or directory

五迷三道 提交于 2019-12-07 09:21:05

问题


I've reinstalled Visual Studio 2010 Professional several times to try to get it to work. I had to uninstall Visual Studio 2012 Professional because it wasn't compiling something we did in class.

I completely uninstalled everything including SQL Server..

I went to VC/include and the iostream header file is not there.

#include <iostream>

int main () {

cout << "hello";

system ("PAUSE");
return 0;
}

This is all I'm trying to do because nothing else is working.

It's really driving me crazy because I need to get it working so that I can do my project!!!

Every time I do; new project => empty project => add an item to source =>.cpp

I'm running windows 8.

It just says Error cannot open source file Also, error cout identifier is undefined....

I'm wondering if I should do a system restore? Or if I should just completely reinstall windows 8 from my recovery media?


回答1:


One problem is that you did not include the namespace std.

This is what your code should look like:

#include <iostream>
using namespace std;

int main (void) {
    cout << "hello" << endl;
    system("pause");
    return 0;
}

or you could have done something like this: std::cout << "Hello" << std::endl;

This may be a problem because you did not set your environment to C++. This is how you do it:

  1. Go to Tools > Import and Export settings. If you cannot find it, just search for it in Quick Search
  2. Then go to reset all settings.
  3. Then simply select "Visual C++"
  4. Restart.

That should do the trick. If it does not, you might consider re-installing Visual C++ itself. For VS 2012. If that does not work, then re-install the program.




回答2:


if it is problem with visual studio 2012, install this update.



来源:https://stackoverflow.com/questions/15181537/fatal-error-c1083-cannot-open-include-file-iostream-no-such-file-or-directo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!