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...
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)
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/ ?
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
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)
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)
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.
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!