Dependency problems and classes!
Hi,
I'll cut to the chase I have the following file:
zfx.h
which needs definitions from the file
zfx3d.h
to function. Some of those definitions are classes. Great (not). Unfortunately, very unfortunately, all of my .cpp source files in the project want a copy of zfx.h to work. This means they all get a copy of the definitions in zfx3d.h and then the linker blows up. Fine you might think, just split up the declarations in the header file and then put the definitions in a .cpp file.
No such luck. Because alot of the functions in zfx3d.h are inline functions and they have to be declared within the same file or the compiler ..........es about 'used but never defined' warnings.
Forward declarations then perhaps. No such luck, then the compiler moans about finding 'incomplete type' with the zfx.h file.
What I really need to do is one of two things:
1) Allow some kind of forward declaration within zfx.h that allows it to compile without having access to a file that contains the class definitions from zfx3d.h - Compiler problem.
2) Find some way to prevent each and every source file from getting a copy of the definitions within zfx3d.h and making an object of them - Linker problem.
Is there anything I can do here save putting everything bar one source file into a header file or some other horribly drastic over the top method?
Like I said I can't split up the declarations from the definitions in the header file as the functions are mostly inline functions. This seems yet another way for C++ to drive you crazy and hold you back even after you've long since understood the code involved and are ready to progress.
I truly have no idea what to do here, has anyone got any ideas at all?
Thanks for any help anyone can offer ;)