vector emplace function

Mar 11, 2016 at 6:46am
how can i enable this function via compiler setting?
Mar 11, 2016 at 7:15am
std::vector::emplace is a C++11 feature. You need to get a C++11 compliant compiler.
Mar 11, 2016 at 9:47am
i have c++11 compiler,what do u mean by compliant?
Mar 11, 2016 at 10:57am
"Compliant" means that the compiler correctly implements C++11.

If you tell us which compiler you have (remember, Visual Studio is not a compiler, and neither is Dev-C++, Code::Blocks, Eclipse or Qt Creator) we can tell you how to tell it to use C++11.
Mar 11, 2016 at 12:07pm
i using codeblocks
Mar 11, 2016 at 12:24pm
Yes, that's not a compiler. I did say "remember, Visual Studio is not a compiler, and neither is Dev-C++, Code::Blocks...". Never mind. I am going to guess that you are using the GNU G++ compiler.

http://stackoverflow.com/questions/18174988/how-can-i-add-c11-support-to-codeblocks-compiler
Mar 17, 2016 at 1:03pm
but i after i setting that things my codeblocks still cant use
Mar 17, 2016 at 1:13pm
What error message are you getting?
Mar 17, 2016 at 1:28pm
Run in terminal
gcc --version
(If the compiler binary has other name than "gcc" or is not directly on the path, then figure out the proper name first.)
Mar 17, 2016 at 2:59pm
i have c++11 compiler


What makes you think this?
Mar 29, 2016 at 11:50am
no error msg,just the emplace function is not valid lol
Mar 29, 2016 at 1:38pm
There is no "lol" in the equation. You either know the tools that you use, find out what they are and how they are used, or simply don't.

If you do use GCC or Clang compilers, then their default language dialect is not C++11, even though they might support C++11 (and C++14, and putative C++17).

However, they both should have command-line option -std=ver, where the ver is the language dialect that you need.


You must check from the documentation of the version of the compiler that you do have, what are valid values for ver.

You must check from the documentation of the version of IDE that you have, how to pass that option to the compiler, when the IDE executes the compiler.
Topic archived. No new replies allowed.