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.
-l library Links to a standard library. Use -l mto 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.
-D macro Define a macro, one can also use -D macro= valin order to assign a value for the macro. This will be used for preprocessing all files.

Written by Shlomi Fish