When will Gnu C++ support C++11 without explicitly asking for it?

后端 未结 4 805
一生所求
一生所求 2020-11-29 08:20

Currently, with g++-4.8.1 you have to compile a file in C++11-mode via

g++ -std=c++11 -o prog.x prog.cpp

Is there a plan when I just can sa

4条回答
  •  北海茫月
    2020-11-29 08:27

    UPDATE: The original answer has become outdated in the past 28 months. According to nobar's answer, GCC 6.1 supports C++14 with GNU extensions by default. GCC 6.1 was released on April 27, 2016. I am quite surprised but very happy to see such a fast adoption of the new standard!

    As for the rest of the original answer, I still see value in keeping that part that answers how to make certain flags "default". So I kept it below.


    Is there a plan when I just can say [...]

    You could define default flags in a Makefile and then all you have to say is make.

    The accepted answer to How do I enable C++11 in gcc? should get you started (or some makefile tutorial).

    Another advice that seems to pop up often here at Stackoverflow is to add a bash alias alias g++="g++ --std=c++0x", see here how. However, I personally wouldn't do this though, it can lead to unpleasant surprises; there has been breaking changes with C++11. I would create my own makefile and type simply make.


提交回复
热议问题