> On Fri, 11 Jun 2021 at 10:17, Mehdi Megherbi via Gcc-help <gcc-help@xxxxxxxxxxx<mailto:gcc-help@xxxxxxxxxxx>> wrote: > > > > Hi > > > > I'm using ubuntu 20.04 and his default gcc version (9.3.0), with standard C++14 as default. I have to compile from source a lot of scientific toolkits, all made with C++11. After a lot of research I was not able to find a way to select the default standard of g++/gcc, so cmake/make take by default the wrong standard and I get always crashs. > > Crashes? What is crashing? The toolkits you're compiling? GCC? Cmake? > Do you just mean it doesn't compile, or is it compiling and then crashing when you run the software? > > Most C++11 code will compile without problems using -std=gnu++14, so I'm not sure what the problem is. > > >>sorry for not getting more informations, for example with ROOT cern > >>toolkit, if you let C++14 it will switch to the beta version of > >>ROOT. And Geant4 toolkit also, it creates a lot warnings during > >>compilation. Another decisive exemple is NPTOOL, it simply crash > >>during compilation, because of the standard > > > >There is really no intrensec way to select the default standard used ? > > No. > > Some makefiles will respect the CXXFLAGS variable, but not all. > > A brute force solution would be to create a wrapper script around gcc and g++ which always adds your preferred -std option and put that script earlier in your PATH than the real gcc executables: > > #!/bin/sh > exec g++ "$@" -std=gnu++11 > > >> I'm suposed to write this in .sh file and source it ?