Determining C executable name

arun picture arun · Mar 17, 2009 · Viewed 74k times · Source

When we are compiling a C program the output is stored in a.out. How can we redirect the compiled output to another file?

Answer

paxdiablo picture paxdiablo · Mar 17, 2009

Most C compilers provide the -o option for this, such as:

gcc -o gentext gentext.c
cc  -o mainprog -Llib -lmymath firstbit.c secondbit.o
xlc -o coredump coredump.c