14
votes

Since I upgraded from Eclipse Indigo to Juno (on Ubuntu 12.04), I've been having the problem where it shows "unresolved inclusion" errors for standard libraries (e.g. next to #include <iostream> and #include <vector>, etc.), although the program builds and runs fine (using g++). This only occurs in new projects created with Juno, not old ones from Indigo in my workspace.

Thanks to several other SO questions (see below*), I was able to trace the source of the problem to the absence of the "built-in values" in a project's Properties > C/C++ General > Paths and Symbols > Includes tab:

/usr/include/c++/4.6
/usr/include/c++/4.6/x86_64-linux-gnu
/usr/include/c++/4.6/backward
/usr/lib/gcc/x86_64-linux-gnu/4.6/include
/usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include 

are present when the "Show built-in values" checkbox is ticked in my old Indigo projects that didn't have this problem, but are absent in my new projects created with Juno. Sure enough, if I add these seven directories manually to the Includes tab in a project's settings, the problem disappears. But I don't want to have to do this manually for every new project I create. Is there a reason this is no longer the default in Juno, and is there a way to restore it?

*Other SO questions with similar issues I have consulted but did not solve my problem:

2
This kind of problem happens also with other Eclipse versions, e.g. Kepler, and like you suggest, not just when upgrading the version but in various other scenarios.einpoklum
Suggest you accept @languitar's answer, it works for me...einpoklum

2 Answers

12
votes

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.

0
votes

FWIW:

I found that after importing a project from another computer, I was not getting any thing showing up under the "Includes" section of my project in the Project Explorer. To fix this, I needed to delete the folder /workspace/project/.settings/. For me it only had one file (language.settings.xml).

Then everything was back to normal.