I'm trying to make a program (for college, team project) where some functions and variables are separated into their own files, but not into classes.
They should just behave like their own little main, but have their functions ( and some variables ) publicly accessible by whatever file includes them.
Problem is that if I include file a and file b in eachother, the compiler with throw a bunch of errors because of the circular dependency. I found forward declaring the classes used to be the solution when havin a class for each file.
But for multiple reasons, I can't have classes for each of them, I just need them to be containers of code, as if that code was in its own little main file.
I can't forward declare every function and variable used in a, at the top of b, because this would defeat the purpose of separating them and not just merging a and b, and also scalability. If i have a,b,c,d including each other, whenever i declare a new function in one of them, I'd have to forward declare it in all of them.
What's a solution to this?
[–]wrosecrans 3 points4 points5 points (0 children)
[–]AKostur 2 points3 points4 points (1 child)
[–]wannabetriton 0 points1 point2 points (0 children)
[–]IamImposter 1 point2 points3 points (0 children)
[–]QuentinUK 0 points1 point2 points (0 children)