When you link the program, you need to provide both Main.o and Person.o as inputs.
The assembly is usually performed in two stages (1) compilation and (2) binding. To compile your sources, follow these steps:
$ gcc -c -o Main.o Main.c $ gcc -c -o Person.o Person.o
Then the resulting object files must be linked into one executable file:
$ gcc -o Main Main.o Person.o
For small projects of several compilation units like yours, both steps can be performed with a single gcc call:
$ gcc -o Main Main.c Person.c
both files must be specified because some characters in Person.c are used by Main.c
For large projects, the two-step process allows you to compile only what was changed during the generation of the executable file. This is usually done through a Makefile.
Diego source share