title: Undefined reference to constructor
body: <p>I'm a Java developer experimenting with C++.</p>
  
  <p>I just created a new class. In my other class I want to have list where I can store Filter objects.</p>
  
  <p><strong>Filter.h</strong></p>
  
  <pre><code>#ifndef FILTER_H_
  #define FILTER_H_
  
  class Filter {
  public:
    Filter(int id);
    int id;
    ~Filter();
  
  };
  
  #endif /* FILTER_H_ */
  </code></pre>
  
  <p><strong>Filter.cpp</strong></p>
  
  <pre><code>#include "Filter.h"
  
  Filter::Filter(int id) {
  this.id = id;
  }
  Filter::~Filter() {
  }
  </code></pre>
  
  <p><strong>Cars.h</strong></p>
  
  <pre><code>#include "Filter.h"
  ...
  ...
  private:
    std::vector&lt;Filter&gt; filters;
  </code></pre>
  
  <p><strong>Cars.cpp</strong></p>
  
  <p>so in a function here I try to do this:</p>
  
  <pre><code>int id = 2;
  Filter *filter = new Filter(id);
  </code></pre>
  
  <p>which generate this error:</p>
  
  <pre><code>Cars.cpp:120: undefined reference to `Filter::Filter(int)'
  stl_construct.h:83: undefined reference to `Filter::~Filter()'
  </code></pre>
  
  <p>What's the reason for this?</p>