public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc default standard
@ 2021-06-11  9:16 Mehdi Megherbi
  2021-06-11 11:32 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Mehdi Megherbi @ 2021-06-11  9:16 UTC (permalink / raw)
  To: gcc-help

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. There is really no intrensec way to select the default standard used ? cmake projects sometimes add an option to select the standard for compilation but unfortunetly not all projects

Regards
Mehdi


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: gcc default standard
@ 2021-06-11 20:30 Mehdi Megherbi
  2021-06-11 21:01 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Mehdi Megherbi @ 2021-06-11 20:30 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-11 21:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11  9:16 gcc default standard Mehdi Megherbi
2021-06-11 11:32 ` Jonathan Wakely
2021-06-11 20:30 Mehdi Megherbi
2021-06-11 21:01 ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).