VisualStudio 2015 RC Issue with Includes

2020-07-27 01:57发布

问题:

Pulling out my hair on what should be a simple issue with using VC++ and being unable to access the default includes.

After installing Visual Studio 2015 RC, I can no longer build C/C++ projects. I receive "IntelliSense: cannot open source file '*.h'" errors for all the various standard library *.h files.

I confirmed that my files do exist in the default locations (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include), and if I right-click on my #include <cstdio> line in the editor I can choose "Open Document" and it even opens automatically in the editor.

My Include Directories string in the Project Settings is:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include;C:\Users\Kristopher\Libraries\Includes;$(VC_IncludePath);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSDK_IncludePath);‌

Has anyone else run into this? I feel like I'm overlooking something simple.

回答1:

Your IncludePath should not specify the Visual C++ and Windows SDK include paths directly. Instead, it should specify only the paths specific to your project and derive from the IncludePath defined in the common C++ MSBuild targets. E.g.,

<IncludePath>C:\Users\Kristopher\Libraries\Includes;$(IncludePath)</IncludePath>

To address your particular case: In Visual C++ 2015, the bulk of the C Runtime (CRT) has been refactored into a new Windows operating system component, the Universal CRT. Its headers and libraries are now in a different location and your project fails to include this include path into the IncludePath property. Specifically, you need to include $(UniversalCRT_IncludePath). For more details, see the article I wrote earlier this year, "Introducing the Universal CRT."