'How to prevent Visual Studio from marking identifiers as undefined in C++?

I have cloned a repository and Visual Studio is showing hundreds of errors in all of the header files due to them not #include-ing all of their used dependencies, even though the solution builds just fine. From what I understand, this is because header files do not need to include everything they use as long as they themselves are included after their dependencies in the files where they are used.

When I asked the repository owner about this they said that this is a bug that was not present in previous Visual Studio editions, therefore meaning that there should be a way to make Visual Studio treat all the identifiers not included in a header as actually included.

I found that main.cpp includes every header and in the correct order, ensuring that even if a given header doesn't include all that it uses it will still compile just fine. Is there a way to make Visual Studio keep track of all the previous includes from the frame of reference of main when in a given header, therefore preventing all the identifier ... undefined errors inside the headers?

EDIT: It seems that the files aren't getting scanned by Visual Studio for some reason, as when I manually open files and pin them, the errors start going away. Is there some way to force Visual Studio to automatically consider the entire solution at once instead of having to open every single header?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source