KNV KNV - 1 year ago 112
Linux Question

Use of -g and -o options in gcc command in c programming

Suppose there are 2 c program named abc.c and xyz.c . Now we want to work with the 2 executables at a time. So we change the name of the ./a.out using

gcc -g abc.c -o abc
gcc -g xyz.c -o xyz

gcc -o abc abc.c
What does the
in the above commands specify or describe?
What is the significance of
in the command for renaming ./a.out file.
Thanks in advance.

Answer Source

-g means to leave debugging information in the output file, it's unrelated to renaming.

-o means to put the result in the specified file instead of the default filename (abc.o for object files, a.out for linked executable files).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download