I wonder what does the command
gcc -o sample sample.c
really means and what it does in the system.
I know gcc
is the command to invoke gcc compiler, but what does -o and filename(without extension) followed by filename(with extension) means here.
Best Answer
Your question
What
gcc -o sample sample.c
actually doesThe command you have pasted triggers
gcc
to compilesample.c
. As a result you'll get an output/executable with the samesample
.The parameters (as -o in your example which defined the name of the output file ) are explained in the man page of gcc. You can open it by running
man gcc
I am quoting the
-o
section of the man page hereIn General
Wikipedia explains a good amount of gcc here.
I am quoting only the start - but the complete article is worth a read and offers a lot of additional links and references