Working with multiple source files
I've seen you all working with multiple source files and I want to do it too!
I have
main.c
function1.c
function2.c
Now how do I link them together? I mean do I have to add something in main.c to include the other two files or what and how to do that? I am using command line to compile.
Someone told me to do
Code:
gcc main.c function1.c function2.c -o executable
And some other random guy told me to
Code:
#include "function1.c"
#include "function2.c"
in main.c But both give me 200 errors (probably some of them are syntax errors)
Anyway, which is the correct way to do this?
Thanks