Eclipse Cdt Indexer Lost After System Update

Eclipse CDT indexer - how to solve unresolved includes

Ok, so I've now fixed this issue.

  1. Unresolved includes from other projects in the workspace and third-party libraries was solved by adding the other projects as references. I guess the compiler knew where to look because I'd added the locations to the Includes list, but the indexer didn't (possibly due to eclipse only processing headers once?)

  2. Unresolved includes from STL I fixed by changing all my .c files that were actually C++ to .cpp. Just changing the compile command to 'g++' obviously wasn't enough to tell the indexer to treat the project as C++.

In the case of 1), I needed to clean/rebuild index of the referenced projects first to remove the unresolved include errors.

Why doesn't Eclipse CDT Indexer index the right configuration?

After spending more time playing around with the IDE, I found the source of the problem. In the global Indexer preferences page (Window -> Preferences -> C/C++ -> Indexer), one should select Use active build configuration rather than Use the build configuration specified in the project's indexer settings

Sample Image

In Eclipse 4.6.3+CDT, how do I ensure the indexer ranks project headers before system ones?

You need to change the order of the providers in Project Settings -> C/C++ General -> Preprocessor Include Paths -> Providers.

Change it so that CDT GCC Built-in Compiler Setting is below, and therefore lower priority, than project local settings.

Here is my MCVE. On my machine I have /usr/include/arpa/ftp.h which has amongst others, the following definitions:

#define PRELIM      1   /* positive preliminary */
#define TYPE_A 1 /* ASCII */

If I create a main.c with these contents:

#include <arpa/ftp.h>

#ifdef TYPE_A
#error Wrong ftp.h!
#endif

#if PRELIM != 8
#error Wrong ftp.h!
#endif

int main() {}

And my "overridden" ftp.h in my project in include/arpa/ftp.h with the same contents, except PRELIM now == 8 and TYPE_A is commented out.

And a Makefile like this:

all:
gcc main.c -o main -Iinclude

If I build without the -Iinclude, I get #error Wrong ftp.h! and with the -Iinclude everything works fine.

However, if I open my editor I get the two #ifdef blocks enabled, and therefore CDT is reporting an error.

Then go to Project Settings -> C/C++ General -> Paths and Symbols -> Includes tab and add my project's include directory to the Include directories.

Still fails, because of the order of processing.

Then go to Project Settings -> C/C++ General -> Preprocessor Include Paths -> Providers tab and move CDT GCC Built-in Compiler Settings below CDT Managed Build Settings Entries

As shown:
Sample Image

Here is a before and after settings change:Sample Image

No index in Eclipse CDT project checked out from SVN

Here is the solution found after a million attempts. The project should be checked-out as C/C++ project, by selecting import using new project wizard.. The index will NOT be available in the SVN projects checked-out directly. Hope it saves some one's time

Eclipse Juno with CDT Doesn't Add Built-in Include Directories

Please

  • Open the Eclipse Preferences dialog (Windows | Preferences).
  • Open C++ | Build | Settings.
  • Open the Discovery tab.
  • Select the built-in compiler settings entry.
  • Press the Clear Entries button.

Afterwards eclipse should request the defaults again from the compiler.

On Arch Linux I had to do this after each GCC version change, because in that case the locations for the defaults changed as the version is encoded in the folder name, and eclipse does not notice this.



Related Topics



Leave a reply



Submit