C++ – Eclipse CDT Builtin Include Directories

ceclipseeclipse-cdtgcclinux

Under

Eclipse CDT >
    Project Settings > 
        C/C++ General >
            Paths and Symbols >
                 Includes >
                     GNU C++

There is a list of include paths.

Some are in bold and are project specific.

Others are builtin:

For example:

 /usr/include/C++/4.6/
 /usr/include/x86_64-linux-gnu
 etc

If I delete:

work/.metadata/.plugins/org.eclipse.cdt.make.core/*.sc

The paths are automatically rescanned when Eclipse launches.

I have gcc 4.6 and gcc 4.7 installed side-by-side.

When Eclipse rescans it only finds the 4.6 headers and not the 4.7 ones.

My question is this: By what mechanism does Eclipse determine the list of builtin include paths? (and hence why is it only finding the 4.6 headers and not the 4.7 headers?)

Best Answer

This is controlled by the settings on Project->Properties->C/C++ Build->Discovery Options. By default, Eclipse will call g++ to discover the include directories. The first instance of g++ on the path will be the one that gets invoked. You can always set the full path to the compiler you want it to use for your project.