Linux C++ compiler

Kevin Kofler kevin.kofler at chello.at
Sun Jan 31 09:19:05 UTC 2010


Peter Langfelder wrote:
> g++ -o executable program.cc

It's a bad idea to use g++ or gcc with no optimization switches as the 
default is no optimization whatsoever. Please use at least -Os (optimize for 
size) or -O2 (optimize for speed (at "level 2"), which is what Fedora is 
using).

You'll probably also want to use -g if you want to be able to use a debugger 
on your executable.

Those are just the basics, gcc/g++ have many useful switches and Fedora uses 
a whole bunch when compiling its packages (and some upstream projects add 
even more).

        Kevin Kofler



More information about the users mailing list