本文介绍了为什么Netbean不会识别`cbegin()`,`cend()`,`unordered_set`和其他C ++特性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我的C ++应用程序在Netbeans中按预期编译和运行。但是,代码帮助不能识别 cbegin(), cend(), unordered_set ,如下红色下划线所示: 但是,代码帮助不能识别 end()。无效,我试着去项目 - >属性 - >代码协助 - > C ++标准 - > C ++ 11。 解决方案请确保您使用Netbeans版本> = 7.2,因为在此版本中引入了C ++ 11支持(请参见C / C ++)。如果你已经将C ++标准设置为NB中的C ++ 11,你可以重新排序你的procject: 选择您的C ++专案 - >右键 代码协助 - > Reparse Project 编辑: 我使用 NetBeans 7.3 RC1 (使用 GCC 4.7.2 ): #include< iostream> #include< list> int main() { std :: list< int> mylist = {5,10,15,20}; std :: cout<< mylist contains:; for(auto it = mylist.cbegin(); it!= mylist.cend(); ++ it) std :: cout< ''<< *它; std :: cout<< '\\\'; return 0;如果C ++ Standard设置为默认值,这将失败,但是使用C ++ 11(} $ b 项目属性 - > Build - > C ++ Compiler - > C ++ Standard = C ++ 11 b $ bMy C++ application compiles and runs as expected in Netbeans. However, Code Assistance does not recognize terms such as cbegin(), cend(), unordered_set, as evinced by red underscores:Code assistance does recognize end(), however. To no avail, I have tried going to Project -> Properties -> Code Assistance -> C++ Standard -> C++11. What else should I update or configure to let Netbeans Code Assistance recognize these terms? 解决方案 Make shure you use a Netbeans Version >= 7.2 because the the C++11 support was introduced in this version (see "C/C++").If you already have set the C++ standard to C++11 in NB, you can reparse your procject:Selcect your C++ Project --> right clickCode Assistance -> Reparse ProjectEdit:I tested the methods with the following code under NetBeans 7.3 RC1 (using GCC 4.7.2):#include <iostream>#include <list>int main (){ std::list<int> mylist = {5,10,15,20}; std::cout << "mylist contains:"; for (auto it = mylist.cbegin(); it != mylist.cend(); ++it) std::cout << ' ' << *it; std::cout << '\n'; return 0;}With C++ Standard set to default this fails, but with C++11 (Project Properties -> Build -> C++ Compiler -> C++ Standard = C++11)it works. 这篇关于为什么Netbean不会识别`cbegin()`,`cend()`,`unordered_set`和其他C ++特性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-02 08:22