Eclipse cdt: includes the header file correctly, compiles, but highlights the source code: "Unauthorized inclusion"

I have a project that uses a shared library from another project. In the project settings, I put the correct include paths and libraries for the GCC and g ++ compiler (-L and -l). All this compiles well, there are no problems here. But the source code is not parsed correctly. My included header file (which is in another project) is marked as "Unauthorized inclusion, and everywhere I use something from it, the source is also allocated.

#include "myHeader.h" 

Any ideas? thanks!

+6
source share
3 answers

The one you are missing here (probably) tells the pointer where to look for these headers. I usually manage my own Makefile, so I don’t know how to make it work for both the makefile and the Indexer. You will probably find that the solution below will fix both.

About the decision; right-click on the project in the project explorer (or resource explorer) and select "Properties" . Now, under C / C ++ General > Paths and Symbols , click the Enable tab and select “GNU C ++ . Then on the right side you can add various include paths (similar to the -I option on gcc / g ++) button "Add ..." .

After you apply and click OK, it will take some time for the indexer to clear this unresolved object.

+5
source

The title should be included as

 #include "myHeader.h" 

or if it is a standard library header:

 #include <string> 

everything else is invalid.

+1
source

Do not forget to include Providers in the "Preprocessor enable console, macros, etc." .

0
source

Source: https://habr.com/ru/post/925555/


All Articles