0

I need to use the C++ osmium library and I program using Eclipse cdt. To be sure my system is well configured, I managed to compile and link few of the examples by hand using the installed gcc 4.8.2 that is enough according to osmium documentation.

Osmium uses C++11 and it seems my Eclipse has a problem understanding it. I followed the instruction in the not-really-duplicate answer, but does not help.

I added -std=c++11 to the project properties under C++ Build -> Settings -> C++ compiler -> Miscellaneous and under C++ Build -> Discovery Options. I also tried adding the macro __GXX_EXPERIMENTAL_CXX0X__.

Strangely in my main file it seems the C++11 features are working, for example I can write

for (auto a : {1,2,3,4,5}) {}

but the osmium directory I copied in the project instead results filled of errors. It is not a missing include directory since the lines #include <osmium/so/and/so> show no errors.

Similarly, std::move even after including utility, gives the cannot be resolved error.

However, I noticed that the code actually builds, even if Eclipse shows multiple errors around the code.

I stuck, what can I do to set up Eclipse?

EstevaoLuis
  • 2,422
  • 7
  • 33
  • 40
Luce_yu
  • 9
  • 2
  • Which toolchain are you actually using (GCC version)? Also _"but the osmium directory I copied in the project instead results filled of errors"_ sounds suspect for me. You should rather have that library configured and installed on your system, than _copying_ stuff around. – πάντα ῥεῖ Apr 06 '15 at 13:41
  • possible duplicate of [Eclipse CDT C++11/C++0x support](http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support) – Steve Apr 06 '15 at 13:44
  • @Steve Well, it looks o be a problem more oriented to the current toolchain version. In the osmium [README](https://github.com/osmcode/libosmium/blob/master/README.md) it's stated that _"Osmium needs at least GCC 4.8 or clang (LLVM) 3.4."_ I doubt its a problem with Eclipse CDT at all. – πάντα ῥεῖ Apr 06 '15 at 13:58
  • It's difficult to tell the exact problem from the post, as written (at least to me). It seems that the problem is the code builds but Eclipse complains about errors. Eclipse uses its own built-in parser, not the compiler. – Steve Apr 06 '15 at 14:01
  • Edited the question with more info. @Steve, I see, how can I setup that built-in parser? – Luce_yu Apr 06 '15 at 14:03
  • Perhaps the answer to this other question helps? http://stackoverflow.com/questions/13591020/eclipse-cdt-parser-support-for-c11?rq=1 – Paolo.Bolzoni Apr 07 '15 at 05:31

0 Answers0