DevC++配置C++11编译器

错误提示:

E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	In function 'int main()':
55	5	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Warning] lambda expressions only available with -std=c++11 or -std=gnu++11
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Error] no matching function for call to 'sort(std::vector<Order>::iterator, std::vector<Order>::iterator, main()::<lambda(const Order&, const Order&)>)'
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Note] candidates are:
62	0	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\algorithm	In file included from E:/applications/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/algorithm
3		E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	                 from E:\things\算法设计与分析\实验1+实验2\未命名1.cpp
4676	5	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h	[Note] template<class _RAIter> void std::sort(_RAIter, _RAIter)
4676	5	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h	[Note] template argument deduction/substitution failed:
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Note] candidate expects 2 arguments, 3 provided
62	0	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\algorithm	In file included from E:/applications/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++/algorithm
3		E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	                 from E:\things\算法设计与分析\实验1+实验2\未命名1.cpp
4705	5	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h	[Note] template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)
4705	5	E:\applications\Dev-Cpp\MinGW64\lib\gcc\x86_64-w64-mingw32\4.9.2\include\c++\bits\stl_algo.h	[Note] template argument deduction/substitution failed:
E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	In substitution of 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<Order*, std::vector<Order> >; _Compare = main()::<lambda(const Order&, const Order&)>]':
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	required from here
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Error] template argument for 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)' uses local type 'main()::<lambda(const Order&, const Order&)>'
55	6	E:\things\算法设计与分析\实验1+实验2\未命名1.cpp	[Error] trying to instantiate 'template<class _RAIter, class _Compare> void std::sort(_RAIter, _RAIter, _Compare)'

解决方法:这个编译错误是由于你的编译器没有启用 C++11(或更高版本)支持,而 Lambda 表达式是 C++11 中的一个新特性。为了解决这个问题,你需要在编译时启用 C++11 支持。

对于 Dev-C++,你可以按照以下步骤操作:

  1. 打开 Dev-C++。
  2. 点击 “工具” 菜单。
  3. 选择 “编译选项”。
  4. 在 “代码生成” 或 “编译器” 选项卡中,找到 “语言标准” 或类似的设置。
  5. 选择 “ISO C++11” 或类似的选项。
  • 10
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值