vendredi 1 avril 2016

Position of -std=c++11 in g++ command line

I am just curious if the position of the standard selection switch (-std=c++11 for my case) is relevant in g++ command line or not. The reason is that the following:

g++   -ftest-coverage -fprofile-arcs -std=c++11 
      -ansi -fpermissive -finline-functions -Wno-long-long
      -fvisibility-inlines-hidden -m64 -Wall -Wextra 
      -g -o CMakeFiles/http://ift.tt/1Tnyw4g 
      -c /home/work/common/cryptoclass.cpp

does not compile, while the following:

g++   -ftest-coverage -fprofile-arcs
      -ansi -fpermissive -finline-functions -Wno-long-long
      -fvisibility-inlines-hidden -m64 -Wall -Wextra 
      -g -o CMakeFiles/http://ift.tt/1Tnyw4g 
      -std=c++11  -c /home/work/common/cryptoclass.cpp

does compile. The only change is that the -std=c++11 was moved to the end of the switches.

g++ gives the following warning:

error: #error This file requires compiler and 
       library support for the ISO C++ 2011 standard. 
       This support is currently experimental, and must 
       be enabled with the -std=c++11 or -std=gnu++11 compiler options.

Version:

g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

Aucun commentaire:

Enregistrer un commentaire