Issue
A simple question that I cannot seem to find. When I am compiling a program with gcc my professor tells me to have -g and -o when I am compiling it and I am not too sure why. I could not find it in the man pages of gcc with there being so much on there.
For example...
gcc -g -o myprogram myprogram.c
Solution
-g
means to include debugging information, which enables a debugger to know where a named object (variable) is in the memory or registers of the executing process and to know which instructions correspond to which lines of source code.
-o myprogram
says to put the output file in myprogram
. (If you do not specify -o
with a file name, GCC defaults to putting the output in a file named a.out
.)
Answered By - Eric Postpischil