Eclipse CDT Indexer无法完全识别c ++ 11 [英] Eclipse CDT Indexer does not fully recognize c++11
问题描述
首先,我了解-std = c ++ 11标志以启用c ++ 11支持以及将其放置在何处。我已将 -std = c ++ 11
附加到 Project->属性-> C / C ++构建->设置->工具设置-> GCC C ++编译器->其他->其他标志
和编译工作正常。但是索引器无法相处,例如,如果我想使用 std :: map
的 emplace
函数(c ++ 11),它将找不到emplace函数。
First of all, I know about the -std=c++11 flag to enable c++11 support and where to place it. I've appended -std=c++11
to Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Miscellaneous -> Other Flags
and compiling just works fine. But the indexer doesn't get along, for example if I want to use the emplace
function of std::map
(c++11), it will not find the emplace function.
#include <map>
int main() {
std::map<int, int> data;
data.emplace(5,5);
我还检查了以下相关问题:
I've also checked out these related questions:
- Eclipse CDT索引器没有知道C ++ 11容器
- 在Eclipse CDT(Juno / Kepler / Luna)索引器中启用C ++ 11
- http://www.eclipse.org/forums/index.php/mv/msg/373462/909018 /#msg_909018
- Eclipse CDT indexer does not know C++11 containers
- Enable C++11 in Eclipse CDT (Juno/Kepler/Luna) indexer
- http://www.eclipse.org/forums/index.php/mv/msg/373462/909018/#msg_909018
更新:现在,我玩过它甚至都无法识别std :: map类型,尽管可以很好地编译并蚀过所有标题...
Update: Now that I've played around it even doesn't recognize the std::map type, although compiling fine and eclipse finding all headers...
- 编译器Mingw64 GCC 5.2.0
- Eclipse Mars 4.5
- CDT 8.7
推荐答案
Eclipse火星它与以前的版本有些不同。
Eclipse Mars does it a bit differently than the previous versions.
第一步使索引器错误突出显示-在在上面链接的Eclipse CDT(Juno / Kepler / Luna)索引器中启用C ++ 11 。如果您已完成所有这些操作,那么如果我知道您遇到了什么,我将会感到不高兴。
Step one gets the indexer error highlighting working - covered in Enable C++11 in Eclipse CDT (Juno/Kepler/Luna) indexer linked above. If you've already done all this, I'll be smurfed if I know what you've run into. Mars has been a bit wonky so far.
- 转到Project-> properties-> C / C ++ General-> Preprocessor Include Paths。
- 单击提供程序选项卡。
- 单击CDT GCC内置编译器设置MinGW
- 单击上移按钮
- 在语言设置下的提供程序选项
- Go to Project->properties->C/C++ General->Preprocessor Include Paths.
- Click the Providers tab.
- Click CDT GCC Built-in Compiler settings MinGW
- Click Move Up button on the right.
- Under Language Settings Provider Options
- 单击使用在项目之间共享的全局提供程序
- 在Command的命令行末尾添加-std = c ++ 1y以获得编译器规范。
顺便说一句,如果有人知道全局设置在哪里,以便我可以默认此行为,请告诉我。
By the way, if anyone knows where the global settings are so I can default this behaviour, please let me know.
第2步使编译器正常工作
Step 2 gets the compiler working
- 转到Project-> properties-> C / C ++ Build-> Settings。
- 转到工具设置选项卡。
- 展开GCC C ++编译器
- 单击方言
选择C ++标准您希望从语言标准下拉菜单中定位。
- Go to Project->properties->C/C++ Build->Settings.
- Go to Tool Settings tab.
- Expand GCC C++ Compiler
- Click Dialect Pick the C++ Standard you wish to target from the Language Standard drop-down.
这篇关于Eclipse CDT Indexer无法完全识别c ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!