Eclipse CDT Indexer无法完全识别c ++ 11 [英] Eclipse CDT Indexer does not fully recognize c++11

查看:230
本文介绍了Eclipse CDT Indexer无法完全识别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 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.


  1. 转到Project-> properties-> C / C ++ General-> Preprocessor Include Paths。


  2. 单击提供程序选项卡。

  3. 单击CDT GCC内置编译器设置MinGW

  4. 单击上移按钮

  5. 在语言设置下的提供程序选项

  1. Go to Project->properties->C/C++ General->Preprocessor Include Paths.
  2. Click the Providers tab.
  3. Click CDT GCC Built-in Compiler settings MinGW
  4. Click Move Up button on the right.
  5. Under Language Settings Provider Options

  1. 单击使用在项目之间共享的全局提供程序

  2. 在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


  1. 转到Project-> properties-> C / C ++ Build-> Settings。

  2. 转到工具设置选项卡。

  3. 展开GCC C ++编译器

  4. 单击方言
    选择C ++标准您希望从语言标准下拉菜单中定位。

  1. Go to Project->properties->C/C++ Build->Settings.
  2. Go to Tool Settings tab.
  3. Expand GCC C++ Compiler
  4. Click Dialect Pick the C++ Standard you wish to target from the Language Standard drop-down.

这篇关于Eclipse CDT Indexer无法完全识别c ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆