简体   繁体   中英

Visual Studio 2010 can't locate <iostream>

I just installed Visual Studio 2010 and I have a feeling something went pretty awry while I was installing it. I have the following code return an error stating that it can't find the <iostream> file. I looked in the includes folder (C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include) and I only saw 4 files (omp.h, pgobootrun.h, srv.h, wmiatlprov.h). I'm not sure if that's normal, but I'm 99% sure it's not.

Here's my code:

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello, World!";
    return 0;
}

Which returns the following errors:

1>------ Build started: Project: Test2, Configuration: Debug Win32 ------
1>Build started 06/11/2012 0:31:05.
1>PrepareForBuild:
1>  Creating directory "c:\users\jake\documents\visual studio 2010\Projects\Test2\Debug\".
1>InitializeBuildStatus:
1>  Creating "Debug\Test2.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>ClCompile:
1>  Test2.cpp
1>c:\users\jake\documents\visual studio 2010\projects\test2\test2\test2.cpp(2): fatal error C1083: Cannot open include file: 'iostream': No such file or directory
1>  stdafx.cpp
1>c:\users\jake\documents\visual studio 2010\projects\test2\test2\stdafx.h(10): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
1>  Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.65
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

No matter how many Google searches I make I can't figure out how to resolve the issue. Any help is appreciated. If any more detail is needed, I can provide anything required for solving this, thank you.

EDIT 1: I'm not using a precompiled header. I downloaded it from the MSDN website on a page I can't post here because it's tied to the account, but I definitely didn't run out of room (I have around 650 GB free on my hard drive). Yes, I tried re-installing (at least 4 times).

EDIT 2: The page tied to my account was from the Microsoft website. Step-by-step what I did was download the .iso, extract it to a folder with 7zip, run the autorun.exe file, go through with installation (Couldn't have been any errors there, all I did was check the "Privacy Policy" boxes and whatnot), opened up Visual Studio, typed in the code that I have below, and run it. I didn't think that needed any explanation.

我相信您应该尝试重新安装或仅在Visual Studio中执行修复。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM