2

I'm using Eclipse Oxygen CDT on Windows 7 64-bit. I've got MinGW-W64 installed, in a non-standard location but Eclipse reports that it is correctly found. But in the project I'm working on (which is a plain Makefile project), lines like

#include <string.h>

are underlined and marked with a '?' in the margin. I believe the component responsible is the "indexer".

I can solve the problem by adding the MinGW include path to each project (Properties -> C/C++ General -> Paths and Symbols), but that seems like The Wrong Way To Do It, as I'd have to repeat for every new project.

There doesn't seem to be a global setting though -- nothing in Preferences -> C/C++ -> Indexer, and nothing similar to 'Paths and Symbols' in global preferences.

Can I set the include paths used by the indexer once, so that any project using MinGW will "inherit" them?

Chungzuwalla
  • 1,038
  • 6
  • 17
  • BTW, the question at https://stackoverflow.com/questions/12194103/eclipse-cdt-indexer-how-to-solve-unresolved-includes looks related but does not answer my question, as it deals with headers from other projects in the workspace. – Chungzuwalla Sep 08 '17 at 03:52
  • "Eclipse reports that it is correctly found" - where does it report that? – HighCommander4 Sep 10 '17 at 01:28
  • @HighCommander4 in "New -> Makefile project from existing code", I have "show only available toolchains" checked. "MinGW GCC" is included in the list. Also, the docs say one of the ways Eclipse finds MinGW is by ensuring mingw32-gcc.exe is on the system path, which it is. – Chungzuwalla Sep 10 '17 at 07:04

1 Answers1

5

OK, well I've found what worked for me. I went to:

Project Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc.

And selected the Providers tab. An entry "CDT GCC Built-in Compiler Settings MinGW" was present, but was not checked. I checked this and ensured "Use global provider shared between projects" was checked. Hit Apply, and every project was magically re-indexed and the headers are now found.

Thanks are due to @HighCommander4's comment which prompted me to poke around the settings a bit more.

Chungzuwalla
  • 1,038
  • 6
  • 17