Visual Studio 2022 (C++) – Intellisense Not Finding Include Files

Visual Studio 2022 Version 17.10.2

Visual C++ 2022

Visual Studio IntelliCode 2.2

I have a VS2022 solution that uses an #include file from a folder outside. The file is not directly included in the project file. However, I have the #include search path set in the project properties, and the project compiles successfully.

But Intellisense and the real-time error detection cannot find the file. So my source code is littered with the red squiggles indicating syntax errors wherever anything defined in the #include file is referenced.

cannot open source file

I have tried all the standard advice (remove the .vs folder, remove the .db files, restart VS2022 and reload) and the in-line errors still persist, even though the project itself compiles correctly.

If I try to “Go to Document” on the #include file, I get an error dialog.

Error dialog

So it seems there is a disconnect between the #include search path that Intellisense is using and the one the compiler is using.

Any advice? Thanks.

Read more here: Source link