title: LNK2019: unresolved external symbol in VS unit-testing
body: <p>I get the error as stated in the title. I ensured the following:<br>
  - The Include directory, include library and additional include directory are set correctly<br>
  - In the properties, Subsystem is set to CONSOLE  </p>
  
  <p>Comments to my code:
  LifeLib is a project that contains classes of that I want to test some methods. The classes are defined in namespace LifeLib. One of them is StornoTafel. testVariables is NOT defined in any namespace.<br>
  I get the linking error 3 times, for 2 constructors and 1 method in StornoTafel (noted in the code).</p>
  
  <pre><code>//project Tester
  #include "stdafx.h"
  #include "CppUnitTest.h"
  
  #include "../LifeLib/StornoTafel.h"
  #include "../LifeLib/testVariables.h"
  
  using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  
  namespace Tester
  {       
      TEST_CLASS(AggSelTest)
      {
      public:
          LifeLib::StornoTafel stornoTafel_; // LNK2019
          LifeLib::StornoTafel *stornoTafel_; // no error, but I need an instance and not a reference to proceed -&gt; see init method
          LifeLib::testVariables test_vars_; // everything is fine
  
          TEST_METHOD_INITIALIZE(init) {
              stornoTafel_ = StornoTafel(test_vars_.lapseProb); // when this line is commented out I only get the first error (see below)
          }
      }
  }
  
  // testVariables.h
  #pragma once
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  class testVariables {
  public:
      testVariables() {};
  // here are a lot of vectors with values for testing purposes
  std::vector&lt;double&gt; _lapseProb= {0,1,2}; // [...]
  };
  
  // StornoTafel.h
  #pragma once
  #include "masterheader.h"
  
  namespace LifeLib {
      class StornoTafel {
      public:
  
          StornoTafel(); //LNK2019
          StornoTafel(std::vector&lt;double&gt; ProbabilityOfLapseInYearT); //LNK2019
  
          StornoTafel(const StornoTafel &amp;obj); //no error
  
          StornoTafel operator=(StornoTafel const&amp; rhs); //LNK2019
  
          //! \name Getter
          //@{ 
          const std::vector&lt;double&gt;&amp; Stornowahrscheinlichkeit() const;
          //@}
      protected:
          std::vector&lt;double&gt; Stornowahrscheinlichkeit_;
      };
      inline const std::vector&lt;double&gt;&amp; StornoTafel::Stornowahrscheinlichkeit() const {
          return Stornowahrscheinlichkeit_;
      }
  }
  
  //StornoTafel.cpp
  #include "StornoTafel.h"
  
  LifeLib::StornoTafel::StornoTafel() {
  }
  
  LifeLib::StornoTafel::StornoTafel(std::vector&lt;double&gt; ProbabilityOfLapseInYearT) {
      Stornowahrscheinlichkeit_ = ProbabilityOfLapseInYearT;
  }
  
  LifeLib::StornoTafel::StornoTafel(const StornoTafel &amp;obj) {
      Stornowahrscheinlichkeit_ = obj.Stornowahrscheinlichkeit_;
  }
  
  LifeLib::StornoTafel LifeLib::StornoTafel::operator=(StornoTafel const&amp; rhs) {
      Stornowahrscheinlichkeit_ = rhs.Stornowahrscheinlichkeit_;
      return *this;
  }
  
  //masterheader.h
  #pragma once
  #include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  
  #include &lt;algorithm&gt;
  #include &lt;ctime&gt;
  </code></pre>
  
  <p>errors in detail:</p>
  
  <blockquote>
    <ol>
    <li>LNK2019    unresolved external symbol "public: __cdecl
    LifeLib::StornoTafel::StornoTafel(void)"
    (??0StornoTafel@LifeLib@@QEAA@XZ) referenced in function "public:
    __cdecl AggSelTester::AggSelTest::AggSelTest(void)" (??0AggSelTest@AggSelTester@@QEAA@XZ)</li>
    <li>LNK2019  unresolved external
    symbol "public: __cdecl LifeLib::StornoTafel::StornoTafel(class
    std::vector >)"
    (??0StornoTafel@LifeLib@@QEAA@V?$vector@NV?$allocator@N@std@@@std@@@Z)
    referenced in function "public: void __cdecl
    AggSelTester::AggSelTest::init(void)"
    (?init@AggSelTest@AggSelTester@@QEAAXXZ)</li>
    <li>LNK2019  unresolved external
    symbol "public: class LifeLib::StornoTafel __cdecl
    LifeLib::StornoTafel::operator=(class LifeLib::StornoTafel const &amp;)"
    (??4StornoTafel@LifeLib@@QEAA?AV01@AEBV01@@Z) referenced in function
    "public: void __cdecl AggSelTester::AggSelTest::init(void)"
    (?init@AggSelTest@AggSelTester@@QEAAXXZ)</li>
    </ol>
  </blockquote>
  
  <p>Why do they arise?</p>