title: C++ LNK2005 'already defined' errors - files referencing themselves
body: <p>I have inherited a C++ solution with 3 projects, one compiling to a .DLL, the other two to .EXEs . The DLL builds on its own fine, but the other two, when built, produce around 65 LNK2005 errors, the majority of which are referencing the same .obj file, as shown in the log exert  below:</p>
  
  <hr>
  
  <pre><code>Linking...
  Function.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
  Function.obj : error LNK2005: _ReadLocalRegister already defined in Function.obj
  Function.obj : error LNK2005: _getSource already defined in Function.obj
  Function.obj : error LNK2005: _SendLogEvent already defined in Function.obj
  Function.obj : error LNK2005: _DebugMsg already defined in Function.obj
  Function.obj : error LNK2005: _MyInformationMsg already defined in Function.obj
  MyNTService.obj : error LNK2005: "public: __thiscall CMyNTService::CMyNTService(void)" (??0CMyNTService@@QAE@XZ) already defined in MyNTService.obj
  MyNTService.obj : error LNK2005: "public: virtual void __thiscall CMyNTService::OnStop(void)" (?OnStop@CMyNTService@@UAEXXZ) already defined in MyNTService.obj
  MyNTService.obj : error LNK2005: "public: void __thiscall CMyNTService::SaveStatus(void)" (?SaveStatus@CMyNTService@@QAEXXZ) already defined in MyNTService.obj
  </code></pre>
  
  <hr>
  
  <p>....and so it goes on!</p>
  
  <p>I am a C# coder, only basic C++ knowledge, so I am lost with this. The solution is an 15 year old C solution I am attempting to rebuild as a C++ solution in VS2008. I have managed to build it once, nothing has changed, but perhaps some config settings have changed since then.</p>
  
  <p>Does anyone have ideas where I could start to look...?</p>
  
  <p>Many thanks!</p>