C ++ compiler: 'class std :: vector <std :: vector <char>>' does not have a name named 'emplace_back'
I get an error from the compiler when coding C ++. Here is my code:
#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; } and here is my mistake:

Any idea what causes this?
I am using Codeblocks 12.11, Windows 7, and my compiler is the GNU GCC Compiler
Thnx for help :)
UPDATE:
If someone is facing the same problem, here is the solution (in Codeblocks 12.11):
Go to: Settings → Compiler → Compiler Settings → Check the following boxes:

In addition to this, remember that your code has a main function. Otherwise, the compiler will throw the following error:

The solution was provided by users who responded to my post :)
Your compiler does not support C ++ 11. The emplace_back member emplace_back from std::vector<T> added since C ++ 11, as you can see .
Depending on your version of the compiler, you probably just need flags to tell the compiler to enable C ++ 11 functions. You can do this in GCC and Clang with:
-std=c++11 -stdlib=libc++ Otherwise, you may need to upgrade your compiler to a later version.