需要在CDT设置如下:
1.菜单:
Window
-> Preferences
-> C/C++
-> Build
-> Settings
-> Discovery
-> CDT GCC Build-in Compiler Settings
添加
-std=c++11
2.右键项目属性:
Properties
-> C/C++ Build
-> Settings
-> Tool Settings
-> GCC C++ Compiler
-> Dialect
添加 -std=c++11
到 other dialect flags
或者列表里面选择 ISO C++11
3.右键项目属性:
Properties
-> C/C++ General
-> Preprocessor Include Paths, Marcos etc.
-> Providers
使 CDT GCC Build-in Compiler Settings
优先 Contributed PathEntry Containers
4.菜单里面选择 Project
-> C/C++ Index
重建索引使c++ 11的代码提示正确。