0

I just set up a new project from this repository in Visual Studio Community 2015. Looking at the Solution Explorer, every single header file from this repository is included in the project.

However, opening a file (for example, atomic.h), will lead to most include directives being underlined in red with a mouseover-text cannot open source file "...". Continuing with the example file:

#ifndef ATOMIC_H
#define ATOMIC_H

#include "quantum.h" //underlined
#include <stddef.h>  //not underlined

Yet the file is most certainly included in the project. It can be seen in the "Header Files" filter in the Solution Explorer. And it is included in the .vcxproj file:

<ItemGroup>
    [...]
    <ClInclude Include="quantum\quantum.h" />
    [...]
</ItemGroup>

According to this answer, the inclusion of a file using the ClInclude tag should be enough to let IntelliSense find it, but it somehow doesn't seem to.

I can fix this by including every single folder and sub-folder separately in the VC++ Include Directories as mentioned here but that would take me hours. I also changed the double quotes to angled brackets, but that didn't help and I don't want to do that on a repo that I'm going to commit to either when it's working for everybody else.

Is there any way I can point IntelliSense to all the files that are obviously included in the project?

There's no need to build with MSVC, I only want IntelliSense to work properly.

Community
  • 1
  • 1
iFreilicht
  • 13,271
  • 9
  • 43
  • 74

1 Answers1

0

I downloaded the example that you provided and got the same result like yours, from the .vcxproj file, the ‘ClInclude’ child element is under ‘ItemGroup’ element. This child element specifies the name of the header file for the C/C++ source file, we can know it from this, not means it will be auto complied.

We still need to add those parent folders of each #include "xxx.h" into the Node ‘AdditionalIncludeDirectories’ like you found. When you added it, then build and check the .vcxproj file, the addition include directory information should display like the following: enter image description here

It will be a huge job to add those required folders into the Node ‘AdditionalIncludeDirectories’, you need to search the ‘xxx.h’ and find the record under ‘ClInclude’, copy the parent folder of this file and add into the node ‘AdditionalIncludeDirectories’ like the above, then reload the project and the intellisense works fine.

Sara Liu - MSFT
  • 6,007
  • 1
  • 21
  • 27
  • Thanks for trying it out! As I said, I don't build this with Visual Studio, so MSBuild isn't really involved and I don't even have "AdditionalIncludeDirectories" in the project options, just "IncludeDirectories". Still, manually adding all of the folders seems like the only option. – iFreilicht Jan 19 '17 at 10:31