I am working with three different libraries, a Core (can be compiled as static or DLL), Graphics (can be compiled as static or DLL - Dealing with Ogre), Physics (can be compiled as static only due to licensing - Havok). A project then uses a combination of the libraries depending on the needs. The Physics portion is dependent on some functions of the Graphics and Core while the Graphics is dependent on some functionality of the Core. The project works fine with all the libraries statically linked in debug and release. I get the following error when using dynamically linked libraries of the Core and Graphics but a statically linked Physics library.
Error 1 error LNK2005: "public: unsigned int __thiscall OgreFW::FwErrorLog::GetError(void)" (?GetError@FwErrorLog@OgreFW@@QAEIXZ) already defined in FwCore_d_dll.lib(FwCore_d.dll) FwHavok_d.lib
I can see what the error means, but I am confused on how to circumvent this. If my libraries are dependant on each other like this, and the licensing of the physics engine (Havok) only allows static linking, do I need to rethink my design (which is a big problem :( ) or is there a way around it?
Thanks
EDIT: I have already checked to make sure all the libraries are being compiled with MDd
EDIT2: I can use /FORCE:MULTIPLE
but that is hiding the problem rather than solving it
EDIT3: Apologies for several edits. The function GetError() is defined in the header, if I place it in the source file, the linking error goes away. Why is that?