Software Development on LinuxUse of gcc/g++Important gcc Flags

3.1. Important gcc Flags

-ansi This flag tells the compiler to enforce ANSI C standards
-pedantic More pedantic ansi, warnings for stuff you probably didn't mean.
-Wall Show all reasonable warnings (there are more).
-g Produce debug information, necessary for debugging.
-llibrary Links to a standard library. Use -lm to load the standard maths library.
-c Compile or assemble the source files, but do not link. The compiler output is object files corresponding to each source file.
-S Compile only; output assembly code.
-E Pre-process only. Output pre-processed code.
-Dmacro Define a macro, one can also use -Dmacro=val in order to assign a value for the macro. This will be used for preprocessing all files.

Written by Shlomi Fish