我正在尝试在Visual Studio社区2017上构建解决方案,但我不断收到错误" 无法打开包含文件:'stdio.h' ".我已经阅读了几个类似的问题,但仍然无法解决这个问题.看起来在stdafx.h文件中调用了stdio.h文件.以下是更多细节.有什么建议?(我无法嵌入图片,所以请点击链接进行截图.)
系统详细信息:
Windows 10
Visual Studio Community 2017 v.15.2(26430.6)
- 使用C++安装的桌面开发(屏幕截图:安装列表)
第1步:我用C++编写了着名的Hello World程序.
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
第2步:我点击了Build> Build Solution.
问题: 'stdio.h':没有这样的文件或目录.完全错误:
1>------ Build started: Project: HelloWorld, Configuration: Debug Win32 ------
1>stdafx.cpp
1>c:\users\dahiana mini\desktop\learncpp\helloworld\helloworld\stdafx.h(10):
fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
1>Done building project "HelloWorld.vcxproj" -- …Run Code Online (Sandbox Code Playgroud) 我遇到了与这里相同的问题fatal error C1034: windows.h: no include path set
我输入vcvars32.bat并解决了我的问题,但我想链接一些 64 位 .lib 文件,当我这样做时:
cl main.cpp xxxlib.lib
Run Code Online (Sandbox Code Playgroud)
我得到:
warning LNK4272: library machine type 'x64' conflict with target machine type 'x86'
Run Code Online (Sandbox Code Playgroud)
是不是因为我用的vcvars32.bat是32位的?在哪里可以找到 64 位版本?
谢谢