Eclipse indexer proper c++11 syntax highlighting when generating projects with cmake

前端 未结 3 1373
不知归路
不知归路 2021-02-05 18:50

I know you can enable proper syntax highlighting with the GXX_EXPERIMENTAL hack described here: Eclipse CDT indexer does not know C++11 containers

But i think, when gene

3条回答
  •  别跟我提以往
    2021-02-05 19:33

    In version 3.1 of cmake a new variable CMAKE_CXX_STANDARD was introduced that can activate C++11 support. Try something like this:

    cmake ../../src -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_CXX_STANDARD=11
    

    This seems to carry through to the generated Eclipse project. I tried it with verison 3.2.0-rc2 and Eclipse recognized C++11 features like std::shared_ptr<>.

    Some documentation links:

    • CMAKE_CXX_STANDARD
    • Optional Compile Features (read towards the bottom of the section)

提交回复
热议问题