How can I add C++11 support to Code::Blocks compiler?

后端 未结 3 1912
慢半拍i
慢半拍i 2020-11-22 07:55

I\'m writing some code that requires to have C++11 support for my Code::Blocks 12.11. I am using default GNU GCC Compiler came with MingW. Is there any way I can do this?

3条回答
  •  悲&欢浪女
    2020-11-22 08:36

    A simple way is to write:

    -std=c++11
    

    in the Other Options section of the compiler flags. You could do this on a per-project basis (Project -> Build Options), and/or set it as a default option in the Settings -> Compilers part.

    Some projects may require -std=gnu++11 which is like C++11 but has some GNU extensions enabled.

    If using g++ 4.9, you can use -std=c++14 or -std=gnu++14.

提交回复
热议问题