当我编写C++代码时,编译器报错。以下是我的代码:
#include <iostream>
#include <algorithm>
#include <typeinfo>
#include <string>
#include <vector>
std::vector< std::vector<char> > p(std::vector<char> v)
{
std::vector< std::vector<char> > result;
std::sort(v.begin(), v.end());
do
{
result.emplace_back(v);
}
while(std::next_permutation(v.begin(), v.end()));
return result;
}
这是我的错误信息:
有什么想法是什么原因导致了这个错误吗?
我正在使用Codeblocks 12.11,Windows 7,我的编译器是GNU GCC Compiler.
感谢您的帮助 :)
更新:
如果有人遇到同样的问题,这里是解决方案(在Codeblocks 12.11中):
进入:设置 --> 编译器 --> 编译器设置 --> 选中以下复选框:
另外记得在代码中要有一个main
函数,否则编译器将会给出如下错误:
解决方案是由回答我的帖子的用户提供的 :)
-std=c++11
或-std=c++0x
)?