Pick a Free OS

User login

Navigation

GCC options you should know

1.) -w : Inhibit all warning messages.

2.) -W : Print extra warning messages. For example, a function not returning a value, a defined variable not being used. The warning messages issued over here do not imply that the program has not compiled successfully. It just helps to make a perfect program. Code can be cleaned up as you will be notified of unused variables.

3.) -Wswitch : Warn when 'switch' command is used. There are more options here. The man page is the best resource for these additional switches.

Debugging options (Kill those bugs)

1.) -g : Produce extra debugging information in the native O.S. format. This information is of use to only the GNU Debugger (GDB).

-gstab gives debugging information in stab format.

2.) -gdwarflevel : Request debugging information along with level. Default level is set to 2.

Level 1 : Minimal amount of code to backtrack.

Level 3 : Maximum amount of code to backtrack.

3.) -save-temps : Store the temporary generated files, permanently in the current directory. The files are named on basis of the source file.

4.) -O (0 or 1 or 2 or 3)

0: Do not optimize.

1: Optimize. Requires a little more time and a lot of memory.

2 and 3 : Memory hogs but essential when dealing with large functions.