Add a header for each file in the project settings (gcc -include)

I have a project that uses gcc -include file.h

As the gcc documentation says, this ensures that the .h file is included in every file that has been compiled this way (which means that any other files had #include "file.h").

Now I have imported this project into eclipse, and I have configured the include path where this file is located, but I can’t figure out how to do something like gcc -include in setting up the eclipse project. The result of this is that in the editor I have LOT "Symbol xy cannot be resolved", but the project compiles just fine.

Thanks for any help.

+5
source share
1 answer

You can change the CDT GCC Built-in Compiler Settings in stages.

  • Go to Project Properties C/C++ General Preprocessor Include Paths, Macros etc.
  • Select the Providers tab.
  • Select CDT GCC Built-in Compiler Settings
  • Deselect Use global provider shared between projects
  • Add the required GCC flags in the Command to get compiler specs: input field Command to get compiler specs:

(see the highlighted text in the image below)

enter image description here

You probably want to click Store entries in project settings folder

+2
source

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


All Articles