我刚刚升级到Visual Studio 2017社区版,我在加载标准头文件时遇到问题.我从各种头文件中得到507个错误.以下是一些片段:
一些错误:
Severity Code Description Project File Line Suppression State
Error (active) E1696 cannot open source file "errno.h" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cerrno 7
Error (active) E1696 cannot open source file "float.h" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cfloat 7
Error (active) E0282 the global scope has no "acosf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath 629
Error (active) E0282 the global scope has no "asinf" RPGWorld c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017\include\cmath 629
Error (active) E0282 the global scope …Run Code Online (Sandbox Code Playgroud) 首先:我正在使用Microsoft Visual Studio 2012
我是C#/ Java开发人员,现在我正在尝试使用Microsoft SDK和C++为kinect编程.所以我开始使用Color Basics示例,我无法编译它.起初,没有一个类能够找到Windows.h. 所以我安装了(或者重新安装,我不确定)Windows SDK,并将SDK的include目录添加到项目的包含"路径"中.然后所有问题都消失了,除了一个:
Error 5 error RC1015: cannot open include file 'windows.h'. C:\temp\ColorBasics-D2D\ColorBasics.rc 17 1 ColorBasics-D2D
Run Code Online (Sandbox Code Playgroud)
这就是错误.没有理由,系统可以找到它,因为它被用在多个其他文件中,只有这个文件无法使用它.作为参考,整个文件是bugging(ColorBasics.rc):
//------------------------------------------------------------------------------
// <copyright file="ColorBasics-D3D.rc" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || …Run Code Online (Sandbox Code Playgroud) 我正在尝试构建IKVM(请参阅此问题),但现在遇到了与IKVM无关的问题,因此我打开了一个新问题:
使用Visual Studio 2008命令提示符(从"开始"菜单)在IKVM目录上运行nant时,出现以下错误:
Run Code Online (Sandbox Code Playgroud)ikvm-native-win32: [cl] Compiling 2 files to C:\ikvm-0.36.0.11\native\Release'. [cl] jni.c [cl] os.c [cl] C:\ikvm-0.36.0.11\native\os.c(25) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory [cl] Generating Code... BUILD FAILED C:\ikvm-0.36.0.11\native\native.build(17,10): External Program Failed: cl (return code was 2)
我安装了Platform SDK.我错过了什么?我确定这很简单......
编辑#1我刚刚检查过 - 我在路径上有包含windows.h的目录. 编辑#2找到答案(参见下面的答案):包含windows.h的目录需要在"Include"路径变量中.
我是C++的新手,我刚刚参加了2017年的Visual Studio社区.我不太清楚要使用什么工作流程,所以我选择了我的直觉.
当我试图包括windows.h使用时#include <windows.h>,我在下面得到一条波浪线,当我盘旋时,它说
无法打开源文件"windows.h"
这跟conio.h和是一样的stdio.h.