Main
EXAMPLES

Compiling with debugging informations

creating debugging symbols for gdb:
>g++ -c -g program.cpp

Creating static module

>g++ -c program.cpp -o staticModule.o

Compiling with optimalization (use with caution)

basic:
>g++ -c -O program.cpp

stronger:
>g++ -c -O1 program.cpp
>g++ -c -O2 program.cpp
>g++ -c -O3 program.cpp

code size optimalization:
>g++ -c -Os program.cpp

arithmetic instructions optimalization
(This option should never be turned on by any -O option):

>g++ -c -ffast-math program.cpp

unrolling loops whose number of iterations can be determined at compile time or upon entry to the loop:
>g++ -c -funroll-loops program.cpp

Linking with optimalization

remove all symbol table and relocation information from the executable:
>g++ -s program.o -o program.exe
Hosted by www.Geocities.ws

1