Ok so i have a large program and lets say i want to split it up into different parts to make it neater and easier to navigate, how would i use 2 .cpp files in the same project? i tried it before and i had problems doing it. I know .h files are for classes, structs, etc and .cpp files are for code that will never get shared but my code is 765 lines long and its hard to edit and maintain when its in one huge file, and its only going to get bigger so how do i use stuff in one .cpp file in another?
Just use multiple headers. I mean you can have any amount of .h files connected to it, and not just for classes... One could write functions inside a namespace in a header file and then add usingnamespace ....... to the top of the .cpp file.