2

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 Answers1

2

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."

James McNellis
  • 348,265
  • 75
  • 913
  • 977
  • Thank you! Yes, this was the correction. I did not know about the Universal CRT until reading your article and hadn't included $(UniversalCRT_IncludePath). I edited the Microsoft.Cpp.Win32.user property sheet in Property Manager and changed the "Include Directories" string to `C:\Users\Kristopher\Libraries\Includes;$(IncludePath)` per your suggestion, and now I can build projects in Visual C++ 2015. I remember having edited this some time ago to add in my personal Includes directory, which I'm speculating might be why this didn't configure automatically when I installed Visual Studio 2015. – Kristopher Gates Jun 19 '15 at 17:45