使Eclipse CDT 4.4 Luna 支持 c++ 11 的设置

来源:互联网 发布:哪里的棺材知乎 编辑:程序博客网 时间:2024/05/07 16:09

用Eclipse Luna编译C++ 11源码总是出错,编译器用的mingw gcc,需要在CDT设置如下:

菜单:

Window -> Preferences -> C/C++ -> Build -> Settings -> Discovery -> CDT GCC Build-in Compiler Settings

添加-std=c++11

右键项目属性:

Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Dialect

添加 -std=c++11 到other dialect flags 或者列表里面选择 ISO C++11 

如果是CMake项目:

cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ..

右键项目属性:

Properties -> C/C++ General -> Preprocessor Include Paths, Marcos etc. -> Providers

使 CDT GCC Build-in Compiler Settings 优先 Contributed PathEntry Containers 

菜单里面选择 Project ->C/C++ Index 重建索引使c++ 11的代码提示正确。


来自

http://stackoverflow.com/questions/9131763/eclipse-cdt-c11-c0x-support

0 0
原创粉丝点击