I might not even be posing the question correctly, but here’s my situation. I have a namespace into which I want to put all of my global functions. I want to define them all in the corresponding .cpp file. Many of these functions access instances of non-global classes, which may or may not be themselves members of the namespace. I can forward-declare the classes, but I will of course still get linker errors when I try to invoke the class methods. One (terrible-seeming) solution is to define each of these globals after the corresponding classes have been defined, but this puts different functions in different files and I want to avoid this at all costs, doing this seems deeply wrong.
What else can I do? I guess I’m having a conceptual issue here, what sort of design strategies might help resolve this? Do I have to make them static members of the corresponding classes? I don’t like this b/c my classes have long names but my namespace name is short… so just use a typedef? But conceptually these are global functions, so I would like to keep them that way… Thanks for your consideration.
I can’t mark a comment as the answer, so I’ll just post it myself–basically Oli Charnesworth was right, refactoring was the solution. There was a particular class which was causing my circular dependencies problem, and I just redid things so that it no longer depended on the ‘global’ info, rather the ‘global’ info #included it.