Search code examples
c++11g++ansi-c

Why do -ansi and -std=c++11 conflict in g++?


Why does -ansi and -std=c++11 doesn't work together ? (ANSI reverts back to C++98 according to other answers) I am using g++-4.8.

Here is the ANSI ratification of C++11 :

http://webstore.ansi.org/RecordDetail.aspx?sku=INCITS%2fISO%2fIEC+14882-2012

This leaves me perplex. Thanks!


Solution

  • RTFM:

    -ansi
    In C mode, this is equivalent to -std=c89. In C++ mode, it is equivalent to -std=c++98.

    The flag was added before there were multiple versions of the standard, and the flag still has the same meaning.

    Why do you want to use both anyway? If you want -std=c++11 then use that, don't add another flag that means something else contradictory.