title: Mixing static and dynamic (shared) libraries?
body: <p>I am working with three different libraries, a <strong>Core</strong> (can be compiled as static or DLL), <strong>Graphics</strong> (can be compiled as static or DLL - Dealing with Ogre), <strong>Physics</strong> (can be compiled as static only due to licensing - Havok). A project then uses a combination of the libraries depending on the needs. The <strong>Physics</strong> portion is dependent on some functions of the <strong>Graphics</strong> and <strong>Core</strong> while the <strong>Graphics</strong> is dependent on some functionality of the <strong>Core</strong>. 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 <strong>Core</strong> and <strong>Graphics</strong> but a statically linked <strong>Physics</strong> library.</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>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?</p>
  
  <p>Thanks</p>
  
  <p><em>EDIT: I have already checked to make sure all the libraries are being compiled with <strong>MDd</em></strong></p>
  
  <p><em>EDIT2: I can use <code>/FORCE:MULTIPLE</code> but that is hiding the problem rather than solving it</em></p>
  
  <p><em>EDIT3: Apologies for several edits. The function <strong>GetError()</strong> is defined in the header, if I place it in the source file, the linking error goes away. Why is that?</em></p>