Please assume that I don't want to create library file
Lets say,
I have 2 files main.cpp
and function.cpp
. I have 2 methods to compile both the file?
1st) while compiling just include both files,
g++ main.cpp function.cpp
2nd) In main.cpp
file i can include function.cpp
#include "function.cpp"
As far as I know while compiling using 2nd method it will take more time, other than that any advantage/disadvantage?
Also what if i have more files lets say i have 500+ files, all are linked with each other, then which method will be preferable?
In this case if I go with 1st method then I will have to provide 500+ file names in my makefile?
Can anybody help?