g++ setup

Karl F. Larsen klarsen1 at gmail.com
Sat Feb 13 14:10:39 UTC 2010

John D Lamb wrote:
> On Fri, 2010-02-12 at 13:58 -0700, Karl F. Larsen wrote: 
>> 	I have tried to understand man g++ which has 13680 lines of 
>> information. There are two basic types of g++ which are used 
>> in the USA. They are Standard C++ and ANSI/ISO Standard C++.
>> 	Is there a way to change g++ so it uses either of those 
>> standards? In 10.04 I find it set for ANSI/ISO Standard C++ 
>> and would like to change it.
> AFAIK g++ without any options compiles by default against the 1998 ISO
> standard C++ with some gnu extensions. This is equivalent to
> $ g++ -std=gnu++98 …
> If you want strict ISO standard, use
> $ g++ -ansi …
> or
> $ g++ -std=c++98 …
> There is also
> $ g++ -std=c++0x …
> for more recent versions of the standard. But note that g++ doesn’t yet
> support (I think) support everything in every standard. I don’t think
> any c++ compiler does. Typically you get some problems with some kinds
> of template code.
> If you’re looking for compatibility with other systems, -ansi might
> help, though you might also want to use the -pedantic flag so that g++
> gives errors rather than warnings. If you just want the compiler to stop
> you writing poor code (e.g. functions that don’t return a value when the
> should), the -pedantic and -Wall flags help.

	Thanks and I will try your recommended flags and see what works.

73 Karl


	Karl F. Larsen, AKA K5DI
	Linux User
	#450462   http://counter.li.org.
         Key ID = 3951B48D

More information about the ubuntu-users mailing list