C++11 compile issue in eclipse cdt

In order to compile the c++11 enabled code in eclipse, we need to add a flag to GCC compiler. 
Project -> Property ->C/C++ build ->Settings ->GCC C++ Complier ->Miscellanous -> add " -std=c++0x" to flag.

However...

Although in this way we can compile the code for c++11 in cdt, the editor is unaware the c++11 code, so it still shows errors. 

To workaround this, we need to add two symbols in cdt for C++ compiler. 
Properties -> C/C++ General ->Path and Symbols -> add these two symbols
  • "_GLIBCXX_USE_C99_STDINT_TR1" with no value
  • "__cplusplus " with value "201103L"

评论

此博客中的热门博文

Nu förbjuder Kina handel med elfenben

Fader av pingyins

Kineserna vill köpa Volvos kompetens