【发布时间】:2019-04-19 05:12:03
【问题描述】:
我已经安装了最新的 MinGW (8.1.0) 并用 Eclipse Neon 和 Photon 进行了测试
#include <iostream>
#include <unordered_map>
int main(){
std::unordered_map<int,std::string> dict = {{1,"one"},{2,"two"}};
dict.insert({3,"three"});
for(const auto& p: dict){std::cout << p.first << " = " << p.second << std::endl;}
}
编译正常,但insert 方法带有红色下划线。
Eclipse 给出错误:“插入”不明确
有什么方法可以更新 eclipse 索引器之类的吗?
编辑:
将参数强制转换为 const 会消除语法错误
dict.insert(std::pair<const int,std::string>{3,"three"});
编辑 2:
或者您可以将 MinGW (5.1.0) 与 C++11 方言一起使用
编辑 3:
Eclipse Photon R
GCC 7.3.0
编辑 4:
CDT 9.5.5 用于 Photon (19th Nov 2018)
Eclipse 4.6(Neon 2016)不再受支持。 (CDT 9.2)
不再支持 Eclipse 4.8 (Photon 2018)。 (CDT 9.5)
Eclipse 4.9 (2019) 现在正在兴起,从 CDT 9.6 开始。
【问题讨论】:
标签: c++ eclipse-cdt