I am learning C with the GCC compiler and Geany (Arch Linux, if that matters). However, I see that compilation and word collection are used interchangeably in both Geany and the Internet. I ask you to clarify that the way I understand the compilation process is correct, because Googling just bothers me.
Let's say I write a simple helloworld.c file:
#include <stdio.h> int main(void) { printf("Hello world!"); return 0; }
If I run gcc -c helloworld.c , the compiler will create the helloworld.o file. Geany calls this compilation of the process, and the compiler says Compilation finished successfully.
Now, if I run gcc -o helloworld helloworld.c , the compiler creates an executable file called helloworld , and Geany calls to create it. However, the compiler again says Compilation finished successfully.
I understand that the -c option creates an object file and that several of them can be linked together with libraries to create an executable file, but I'm confused about which script is being compiled and which is being created.
Also, if I had only one source file in the project, for example, one helloworld.c file, is gcc -o helloworld helloworld.c to turn the source code into an executable?
thanks
source share