title: Creating class object defined in another project
body: <p>I have a Visual C++ solution with 2 projects: <strong>rectangle</strong> and <strong>project3</strong>.</p>
  
  <p>In rectangle project I have <strong>rect.cpp</strong> and <strong>rect.h</strong>.</p>
  
  <p>rect.h</p>
  
  <pre><code>#ifndef rect_h
  #define rect_h
  class Rect
  {
  public:
      Rect();
  
      int m_h;
      int m_w;
  };
  #endif //rect_h
  </code></pre>
  
  <p>rect.cpp</p>
  
  <pre><code>#include "rect.h"
  Rect::Rect()
  {
      m_h = 1;
      m_w = 5;
  }
  </code></pre>
  
  <p>whenever I try to create rect object from the rectangle project it succeeds.</p>
  
  <p>But when I try to do the same from the project3 it produces a linker error.</p>
  
  <blockquote>
    <p>LNK2019: unresolved external symbol "public: __thiscall
    Rect::Rect(void)" (??0Rect@@QAE@XZ) referenced in function _main
    1>C:\Users\mbaro\documents\visual studio
    2017\Projects\Project2\Debug\Project3.exe : fatal error LNK1120: 1
    unresolved externals</p>
  </blockquote>
  
  <p>main.cpp (in project 3)</p>
  
  <pre><code>#include "rect.h"
  using namespace std;
  
  int main()
  {
      Rect* a = new Rect();
  
      return 0;
  }
  </code></pre>
  
  <p>I kind of feel that class definition is picked up successfully, but the linker can not link the constructor code from rect.cpp.</p>
  
  <p>What is the problem and how to solve it?</p>
  
  <p>Thanks. </p>