5

I have a project which use gcc -include file.h

As gcc documentation say, this ensures that file.h is included in every file which is compiled this way (meaning like there was #include "file.h" in every other files).

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

Thanks for any help.

2
  • So you just need file.h seen from the indexer? I think that can be done adding the header file in the Paths and Symbols properties dialog, but I'm not sure if you can add a specific file. Commented Jan 13, 2016 at 10:00
  • I tried that but it did not help, I think that Paths there are equivalent of gcc -Ipath. Yes I need only that file.h to be seen from indexed. Also I tried setting indexed to index all header (because the file.h is in path I have added in the Paths and Symbols) but that also did not helped. Commented Jan 13, 2016 at 10:10

1 Answer 1

2

You can change the CDT GCC Built-in Compiler Settings on a project-by-project basis.

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

(see highlighted text in image below)

enter image description here

You probably want to click Store entries in project settings folder

Sign up to request clarification or add additional context in comments.

1 Comment

For completeness, the more direct way would be to just add file.h to the Paths and Symbols properties dialog / Include files tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.