It has been a while since I used C++ and I need some help compiling some source codes.

I have a program that contains about 21 files some of these files are header files and some are .cpp files.

When I try to compile the main.cpp file I get a bunch of error saying it cannot find some of the other files that is needed for the main program to run.

I'm using gcc -o main main.cpp to compile the main program (this is when I get the error).

I also tried to compile all the files together by using gcc -o main *.cpp but I still get some errors.

How can I compile the files in the correct order so I can get it to work? I tried to compile some of the other files that has no MAIN in the code, but I cannot get it to compile, I get an error saying undefined reference to main.

Thank you