how to define -std=c++11 as default in g++

Yes, you typically set this in a Makefile:

CXXFLAGS=-std=c++11 

One layer above you can also detect a suitable compiler via autoconfcmake or whichever other meta-buildtool you might deploy.

You of course play games as define g++11 as g++ -std=c++11 but such set-ups are not portable.

g++-6.* will default to c++14 so at some this switch will be implicit. But it might take a really long time for all those RHEL and CentOS boxen with g++-4.4.* to disappear. Those may not even handle your current project…

Leave a Comment