Re: gcc default standard

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Jun 2021 at 10:17, Mehdi Megherbi via Gcc-help
<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.


>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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux