C++ Visual Studio 2010 找不到 iostream
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10055399/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Visual Studio 2010 can't find iostream
提问by JaxDragon
I just installed Visual Studio 2010, and wanted to test it out by writing a hello world application.
我刚刚安装了 Visual Studio 2010,并想通过编写一个 hello world 应用程序来测试它。
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
After trying to compile this I get this error
尝试编译后,我收到此错误
error C1083: Cannot open include file: 'iostream': No such file or directory
错误 C1083:无法打开包含文件:“iostream”:没有这样的文件或目录
Here are my visual studio include directories
这是我的视觉工作室包含目录
$(VCInstallDir)include; $(VCInstallDir)atlmfc\include; $(WindowsSdkDir)include; $(FrameworkSDKDir)\include;
$(VCInstallDir)include; $(VCInstallDir)atlmfc\include; $(WindowsSdkDir)包括;$(FrameworkSDKDir)\include;
And my library directories
还有我的图书馆目录
$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
回答by the_mandrill
If you are unable to build a simple hello world application then it suggests that either Visual Studio or the Windows SDK isn't installed correctly. Have you downloaded and installed the Windows SDK? (note: if you need to build for XP you might need to use the Win7 SDK instead)
如果您无法构建简单的 hello world 应用程序,则表明 Visual Studio 或 Windows SDK 未正确安装。您是否下载并安装了Windows SDK?(注意:如果您需要为 XP 构建,则可能需要改用 Win7 SDK)
I seem to recall that after installing the Windows SDK you may need to 'integrate' it for use with VS2010. Each version of Visual Studio can have a different default SDK that it builds against. You mayneed to run the SDK Configuration Toolto register it for use with VS2010. Alternatively, you might need to check the 'Platform Toolset
' settings in the project, as described here
我似乎记得在安装 Windows SDK 后,您可能需要“集成”它以与 VS2010 一起使用。每个版本的 Visual Studio 都可以有不同的默认 SDK 来构建。您可能需要运行SDK 配置工具来注册它以与 VS2010 一起使用。或者,您可能需要检查“Platform Toolset
项目”的设置,如所描述这里
Ultimately, once that is correctly setup then you should be able to build simple C++ apps without any further configuration.
最终,一旦正确设置,您应该能够构建简单的 C++ 应用程序,而无需任何进一步的配置。
回答by IndieProgrammer
The pages given below may help you:
下面给出的页面可能对您有所帮助:
1.) http://msdn.microsoft.com/en-us/library/8z9z0bx6.aspx
1.) http://msdn.microsoft.com/en-us/library/8z9z0bx6.aspx
2.) http://msdn.microsoft.com/en-US/library/hdkef6tk.aspx
2.) http://msdn.microsoft.com/en-US/library/hdkef6tk.aspx
<iostream>
is normally stored in the C:\Program Files\Microsoft Visual Studio 10\VC\include folder. First check if it is still there.
<iostream>
通常存储在 C:\Program Files\Microsoft Visual Studio 10\VC\include 文件夹中。首先检查它是否还在。
the /P compiler option is uese to preprocess helloWorld.cpp
(say),this will generate helloWorld.i, and then you check to see where iostream
is getting included.
and the builded log should be helpful as well as using the /showincludes option to show the paths to the include files.
/P 编译器选项用于预处理helloWorld.cpp
(例如),这将生成 helloWorld.i,然后您检查以查看iostream
包含的位置。并且构建的日志应该很有帮助,并且使用 /showincludes 选项来显示包含文件的路径。
回答by IND000
Go through the normal easy process of creating a new Project --> Templates: Visual C++ --> Win32 Console Application. If not, search your HDD for iostream and set the include path manually.
完成创建新项目的正常简单过程 --> 模板:Visual C++ --> Win32 控制台应用程序。如果没有,请在 HDD 中搜索 iostream 并手动设置包含路径。