How can I compile C++11 code with Orwell Dev-C++?

Please make sure you supply the correct -std flag when compiling. The default setting that Orwell Dev-C++ uses (don’t pass any -std option), will not enable some shiny new C++11 functions, like unique_ptr. The fix is quite simple:

  • For non-project compilations, go to: Tools >> Compiler Options >> (select your compiler) >> Settings >> Code Generation >> (set ‘Language standard’ to a C++11 option)
  • For project compilations, go to: Project >> Compiler >> Code Generation >> (set ‘Language standard’ to a C++11 option)

Here’s a bit more information about the -std flag:
http://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#C-Dialect-Options

As you can see, GCC uses a GNU dialect of C++03 by default (which doesn’t seem to support unique_ptr).

Leave a Comment