Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++11

g++

ansi

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!

like image 870
Jean-Michaël Celerier Avatar asked Jul 05 '13 03:07

Jean-Michaël Celerier


1 Answers

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.

like image 83
Jonathan Wakely Avatar answered Oct 21 '22 06:10

Jonathan Wakely