Eclipse CDT索引器不知道C ++ 11容器 [英] Eclipse CDT indexer does not know C++11 containers

查看:181
本文介绍了Eclipse CDT索引器不知道C ++ 11容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse CDT中配置了一个C ++ 11项目,以使用gcc-4.7。它不是我的系统上的默认编译器,它不支持C ++ 11。为了编译工作,我需要传递标志 -std = c ++ 11 ,并且还包括以下标题路径: / usr / local / Cellar / gcc / 4.7.2 / gcc / include / c ++ / 4.7.2



每当我使用C ++ 11容器类型像 std :: unordered_set std :: unordered_map ,CDT索引器抱怨:符号unordered_set无法解决。我如何告诉索引器正确解决这些符号?



这是我如何配置我的索引器:





就我而言了解设置,索引器应该使用当前活动的构建配置中的编译器设置。编译工作正常,所以为什么不编索引?

解决方案

正如本论坛帖子所述:



http://www.eclipse.org/forums /index.php/mv/msg/282618/




  • 右键单击项目,然后转到属性C / C ++常规 - >路径
    和符号 - >符号 - > GNU C ++。

  • 点击添加...,粘贴 __ GXX_EXPERIMENTAL_CXX0X __ 进入名称,
    保留值为空。点击申请,做任何要求你做的事情,然后
    点击确定。


I configured a C++11 project in Eclipse CDT to use gcc-4.7. It is not the default compiler on my system, which does not support C++11. In order for compilation to work, I need to pass the flag -std=c++11 and also include the following header path: /usr/local/Cellar/gcc/4.7.2/gcc/include/c++/4.7.2

Whenever I use C++11 container types like std::unordered_set or std::unordered_map, the CDT indexer complains: Symbol unordered_set could not be resolved. How can I tell the indexer to resolve these symbols correctly?

This is how I have configured my indexer:

As far as I understand the settings, the indexer is supposed to use the compiler settings from the currently active build configuration. Compilation works fine, so why doesn't indexing, too?

解决方案

As described in this forum post:

http://www.eclipse.org/forums/index.php/mv/msg/282618/

  • right-click the project and go to "Properties" C/C++ General -> Paths and Symbols -> Symbols -> GNU C++.
  • Click "Add..." and paste __GXX_EXPERIMENTAL_CXX0X__ into "Name" and leave "Value" blank. Hit Apply, do whatever it asks you to do, then hit OK.

这篇关于Eclipse CDT索引器不知道C ++ 11容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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