The problem is probably occurring because you're compiling only Main.c
when you need to be compiling Main.c
and Person.c
at the same time. Try compiling it as gcc Main.c Person.c -o MyProgram
.
Whenever you have multiple files, they all need to be specified when compiling in order to resolve external references, as is the case here. The compiler will spit out object files that will later be linked into an executable. Check out this tutorial on makefiles: Make File Tutorial It helps to automate this process.