Using G++ to compile multiple .cpp and .h files

list all the other cpp files after main.cpp.

ie

g++ main.cpp other.cpp etc.cpp

and so on.

Or you can compile them all individually. You then link all the resulting “.o” files together.

Leave a Comment