EECS 280

g++ Command Summary

 


 

1. Command Line Options (Flags)

 

Command Line Options can be used simultaneously, for example you could use both the o and g flags.

 

% g++ <project files (.cpp)>

      Compiles <project files>, links them and creates the executable in the file a.out.  a.out is automatically overwritten.

 

% g++ -c <project files (.cpp)>

      Compiles <project files> but does not link.  Produces an object file (.o) for each file in <project files>

 

% g++ -g <project files (.cpp)>

      Compiles <project files>, links them and creates the executable in the file a.out.  Symbolic debugging information is contained in the executable for gdb or dbx.

 

% g++ -O <project files (.cpp)>

      Compiles <project files>, links them and creates the executable in the file a.out.  Code is optimized.

 

% g++ <project files (.cpp)>  -o <executable name>

      Compiles <project files>, links them and creates the executable in the file <executable name>.  <executable name> is automatically overwritten.

 

% g++ -Wall <project files (.cpp)>

Compiles <project files>, links them and creates the executable in the file a.out.  All warnings are reported during compiling.

 

% g++ -w <project files (.cpp)>

Compiles <project files>, links them and creates the executable in the file a.out.  No warnings are reported during compiling.

 

2. More information

 

% man g++

http://www.gnu.org

 

Adapted from the GNU g++ manual page.

 


     Last Update: D. Emerson 9/7/2002 10:46:27 AM