Ok well this vered off topic as originally was about file structure more than what tools are used to compile. But figured I'd update, so what I ended doing is going with the original recommended structure I found online, and that's to have every class, function etc in it's own .h and .cpp file respectively. The .h has the prototype of the class/function and the cpp file has the actual code that goes with it. In some cases I might cheat a bit and have a "functions.h" and "functions.cpp" that will just have a bunch of basic functions instead of splitting them up. Each .cpp file includes it's own .h file, and potentially any other .h that may be required but typically forward declaration can solve that so I expect the amount of extra includes to be small. Now, I'm not sure if I should also include all the stuff like iostream in those, or leave that to the main program, I think I will leave those out as it's a given they will be included in the main program. Though if I was to include all that stuff, it would make it possible to compile any .cpp file on it's own.
As far as bringing all the .cpp files together so the main program sees them when I compile, I will use my inventory app which simply goes through my "includes" folder and generates a sources.h file that includes all the .cpp files. I used to also have a includes.h that included all the .h, but I wont need that anymore. The program still has an option to do it but it's off by default. I then include the .h file in my main program below the system includes.
Eventually I will still look into make scripts that have recursive compiling, but I use my inventory program anyway, as it takes care of tagging each file with a header with author and other basic stats like lines of code so either way I'd probably be using my program. This program just kills two birds with one stone basically. It creates headers similar to this:
Code:
/**********************************************************
PostSort C++ source file
No copyright - feel free to distribute, modify etc...
Last modified by Red Squirrel on Jan-23-2016 01:05:45am
Checksum: 87651C4061468B921D49A163597C6F2
Filepath: includes/functions.cpp
Lines of code: 5
Description:
***********************************************************/
The checksum is a new addition I just added, it's basically used to determine if the file changed, so it does not touch it if it did not. It used to go by lines of code before, but that was not really that great of a way to determine.
I do want to look into make and all that stuff but the more I read on it the more involved it sounds, it just looks like it's pretty much a whole other complex skillset to learn, when I could be spending more time learning actual coding instead. I'll want to learn it when I get more serious about releasing programs to the public though as the "./configure, make, make install" way is what is pretty much universally used.