Last Updated: February 09, 2019
·
2.104K
· killwing

Useful gcc/g++ options

-v

Print (on standard error output) the commands executed to run the stages of compilation.

Check include search path order.

-M

Output a rule suitable for make describing the dependencies of the main source file.

List all included headers.

-MM

Like -M but do not mention header files that are found in system header directories.

List all included headers except for system headers.

-E -P

The output is in the form of preprocessed source code, which is sent to the standard output.

Expand included headers and macros.

-O2

Optimize even more.

Suggest optimization level.

-Og (v4.8)

Optimize debugging experience.

Optimization with better debug info.

-W -Wall -Werror

Suggest warning options.

1 Response
Add your response

@maandree thanks for your suggestion.

over 1 year ago ·