Determining C executable name


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

Best Answer

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