You are not logged in.

#1 2013-01-29 23:29:04

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

[SOLVED] Eclipse: wrong GCC version in included headers

I have GCC 4.7.2 on my system, but whenever I create a new C++ project in Eclipse CDT it tries to parse the GCC 4.7.1 include directories. It obviously doesn't finde headers, so in my source files I get lots of errors from the code analyzer, which complains about not finding definitions of standard classes like vector and polluting all the editor with non-existent errors. Is there a way to tell Eclipse which are the GCC include directories, so to force them to version 4.7.2? I searched but I didn't find such option amongst the gazillions of Eclipse options...
Thanks

Edit: I noticed that the problem shows up only if I select "Linux GCC" as toolchain when creating the C++ project. If  I select "Cross GCC" then the 4.7.2 include dirs are correctly parsed.

Last edited by snack (2013-01-30 03:51:02)

Offline

#2 2013-01-29 23:43:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: [SOLVED] Eclipse: wrong GCC version in included headers

I've never used eclipse (or any IDE), but why would the 4.7.2 include directory be any different than the 4.7.1, or any other for that matter as the path is /usr/include/ ?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-01-29 23:46:51

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] Eclipse: wrong GCC version in included headers

The difference is that, having only GCC 4.7.2 in my system, the 4.7.1 include folders like /usr/include/c++/4.7.1 does not exist, but eclipse searches into them instead of searching in /usr/include/c++/4.7.2

Offline

#4 2013-01-29 23:56:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,441
Website

Re: [SOLVED] Eclipse: wrong GCC version in included headers

Oops!  Sorry, I spoke to quickly.  It's been quite a while since I did any c++ and I just use c.  I didn't realize c++ has separate sub directories for compiler versions - that seems very odd.

In a Makefile one would set the -I flag to the path, is there somewhere you set options that would go in a Makefile?

EDIT: Based on the info below I was misreading this.  Sorry for the "noise" as I don't have the experience with eclipse to give useful input.

Last edited by Trilby (2013-01-30 00:11:45)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2013-01-30 00:02:02

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] Eclipse: wrong GCC version in included headers

Thanks Trilby, but maybe I have not been clear. My programs compile fine since the invoked GCC is actually 4.7.2 (that is, the only GCC present in my system). The problem is just tin the eclipse code analyzer, which in principle parses all the included headers to offer informations about classes, objects etc. directly in the editor. For some strange reason, it searches for 4.7.1 headers, it obviously doesn't find them, so he doesn't know what is std::vector and thus it signals every std::vector occurrence as a potential error. My editor now looks like a text file checked by an automatic spell checker setted on the wrong language, it is full of wavy red underlines and this is very annoying...

Last edited by snack (2013-01-30 00:02:23)

Offline

#6 2013-01-30 02:39:38

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: [SOLVED] Eclipse: wrong GCC version in included headers

Probably needs a rebuild with compiler updates...

Offline

#7 2013-01-30 03:24:29

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] Eclipse: wrong GCC version in included headers

I'm not sure to understand your suggestion, Allan. Anyway, I rebuilt eclipse and eclipse-cdt with ABS (actually there's nothing to be built...) and reinstalled them, but it didn't fix the problem.

Offline

#8 2013-01-30 03:50:02

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 861

Re: [SOLVED] Eclipse: wrong GCC version in included headers

I played a bit with Project Properties -> C/C++ general -> Preprocessor Include Paths, and found that in the Providers tab I had to select "CDT GCC Builtin Compiler Settings", then uncheck and check again the "Share setting entries between projects", then click Apply. I think this forced the compiler informations to be re-fetched. After that, I closed and reopened my project and the include directories were then fixed. I'm not 100% sure about the key point of the solution, but I hope this confused report may help.
Thanks everybody for the suggestions!

Offline

Board footer

Powered by FluxBB