title: C++ error LNK2019 && fatal error LNK1120: 1 unresolved externals
body: <p>I am trying to work on a homework assignment for school and am going above what the teacher is asking for the assignment -> I have created a "list" class. I keep running into these two errors after adding the 'add()' method to the program - along with the 'newIncomeTax()' methods</p>
  
  <blockquote>
    <p>error LNK2019: unresolved external symbol "public: void __thiscall List::add(class IncomeTax *)" (?add@List@@QAEXPAVIncomeTax@@@Z) referenced in function _main driver.obj</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>fatal error LNK1120: 1 unresolved externals </p>
  </blockquote>
  
  <p>I hope this will be enough code for anyone trying to help me: </p>
  
  <p>note: the functions below are not in the order that they appear in the original code
  (if that may be the problem I can provide all the code that i'm using)</p>
  
  <h2>list.h</h2>
  
  <pre><code>#ifndef LIST_H
  #define LIST_H
  
  #include "IncomeTax.h"
  class List
  {
  private:
      IncomeTax * First;
      IncomeTax * Last;
      int num_in_list;
  public:
      List () { num_in_list = 0; First = NULL; Last = NULL; }
      int get_num_in_list() { return num_in_list; }
      IncomeTax * getFirst() { return First; }
      IncomeTax * getLast() { return Last; }
      void del_frnt ();
      void push_front (IncomeTax *);
      void push_back (IncomeTax *);
      void del_last ();
      void add (IncomeTax*);
      IncomeTax * pop_back ();
      IncomeTax * pop_front ();
      IncomeTax * get (int);
  };
  #endif
  </code></pre>
  
  <p>note: from what I've seen  the list that **I've** made behaves similarly to the  default </p>
  
  <h2>the 'add' method from list.cpp</h2>
  
  <pre><code>void List:: add (IncomeTax * IncomeTax_to_be_added) {
      if (num_in_list == 0) { First = IncomeTax_to_be_added; Last = IncomeTax_to_be_added; }
      else if (num_in_list != 0 ) {
          Last-&gt;setNext(IncomeTax_to_be_added);
          IncomeTax_to_be_added-&gt;setPrevous(Last);
          Last = IncomeTax_to_be_added;
      }
      num_in_list++;
  }
  </code></pre>
  
  <h2>IncomeTax.h</h2>
  
  <pre><code>#ifndef INCOME_TAX
  #define INCOME_TAX
  
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include "conio.h"
  #include &lt;cassert&gt;
  using namespace std;
  
  class IncomeTax {
  private:
      double incm;
      double ajIncm;
      double subtract;
      double taxRate;
      double add;
      bool married;
  
      void calcIncome_m ();
      void calcIncome_s ();
  public:
      IncomeTax () { incm = 0; subtract = 0; taxRate = 0; add = 0; add = false; }
      // married -&gt; is by default false
      void setmarried ( bool stats ) { married = stats; }
      void setIncm (double in ) { incm = in; }
      void setSubtract ( double sub ) { subtract = sub; }
      void setTaxRate ( double rate ) { taxRate = rate; }
      void setAdd ( double Add ) { add = Add; }
      void setAjIncome ( double AJincome ) { ajIncm = AJincome; }
  
      bool getmarried () { return married; }
      double getIncm () { return incm; }
      double getsubtract () { return subtract; }
      double getTaxRate () { return taxRate; }
      double getAdd () { return add; }
      double getAJincome () { return ajIncm; }
      void calcIncome ();
      void pintIncome ();
  };
  
  #endif
  </code></pre>
  
  <h2>IncomeTax.cpp</h2>
  
  <pre><code>#include "IncomeTax.h"
  using namespace std;
  
  void IncomeTax::calcIncome(){
      assert (incm != 0);
      if (married) { calcIncome_m(); }
      if (!married) { calcIncome_s(); }
  
      ajIncm = (incm - subtract);
      ajIncm -= (ajIncm * taxRate);
      ajIncm += add; 
  }
  
  void IncomeTax::calcIncome_m() {
      assert (incm != 0);
      ... huge nested if statements ... 
      they set subtract, add, taxRate...
  }
  
  void IncomeTax::calcIncome_s() {
      assert (incm != 0);
      ... huge nested if statements ... 
      they set subtract, add, taxRate...
  }
  
  void IncomeTax::pintIncome () {
      assert (incm != 0);
      assert (ajIncm != 0);
  
      std::cout.precision(2);
      cout &lt;&lt; "\tTaxable Income: " &lt;&lt; incm &lt;&lt; endl;
      cout &lt;&lt; "\tAjusted Income: " &lt;&lt; ajIncm &lt;&lt; endl;
      cout &lt;&lt; "\tTax: " &lt;&lt; (incm - ajIncm) &lt;&lt; "\n" &lt;&lt; endl;
  }
  </code></pre>
  
  <h2>Driver.cpp</h2>
  
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cassert&gt;
  #include "IncomeTax.h"
  #include "List.h"
  using namespace std;
  
  void getMaritalStatus( IncomeTax new_tax) {
      bool done = false;
      char stt = ' ';
      while ( !done ) {
          cout &lt;&lt; "\nPlease declare weather you are filing taxes jointly or single" &lt;&lt; "\n";
          cout &lt;&lt; "\t's' = single\n\t'm' = married" &lt;&lt; endl;
          stt = getch();
          if ( stt == 's' || stt == 'm' ) { done = true; }
          if ( stt == 's' ) { new_tax.setmarried(true); }
          if ( ! (stt == 's' || stt == 'm') ) { cout &lt;&lt; "\nyou have entered an invald symbol... \n" &lt;&lt; endl; }
          if(cin.fail()) { cin.clear(); }
          }
      }
  
  
  void get_Income ( IncomeTax new_tax) {
      double _incm = 0;
      char status = ' ';
      bool done = true;
      while ( done ) {
          cout &lt;&lt; "Please enter your TAXABLE INCOME:" &lt;&lt; endl;
          cin &gt;&gt; _incm;
          if ( _incm &gt; 0 ) { new_tax.setIncm(_incm); done = false; }
          if ( _incm &lt;= 0 ) { cout &lt;&lt; "\nthe number you entered was less than zero\nplease enter a valad number...\n" &lt;&lt; endl; } 
          if(cin.fail()) { cin.clear(); }
      }
      }
  
  IncomeTax newIncomeTax () {
      IncomeTax new_tax;
      IncomeTax * temp;
      get_Income(new_tax);
      getMaritalStatus(new_tax);
      new_tax.calcIncome();
      return new_tax;
  }
  
  bool again () {
      bool done = false, answer = false;
      char yn = ' ';
      while ( !done ) {
          cout &lt;&lt; "\nWould you like to calculate another Income tax? (y/n)" &lt;&lt; endl;
          yn = getch();
          if ( yn == 'y' || yn == 'n' ) { done = true; }
          if ( yn == 'y' ) { return false; }
          if ( yn == 'n' ) { return true; }
          if ( ! (yn == 's' || yn == 'n') ) { cout &lt;&lt; "\nyou have entered an invald symbol... \n" &lt;&lt; endl; }
          if(cin.fail()) { cin.clear(); }
          }
      }
  
  int main () {
      IncomeTax new_tax;
      List L;
      bool done = false;
      while (!done) {
          IncomeTax temp = newIncomeTax();
          IncomeTax * ptr = &amp;temp;
          L.add(ptr);
          done = again();
          };
  
      return 0;
  };
  </code></pre>
  
  <p>I know that there are many better ways to do the 'if' statements -> i just decided that it would be efficient to just use the if statments -> the professor has stated that there is no need to go beyond this.</p>
  
  <p>Since this is homework I would love to get some feed back on ways that I can use better programing techniques. thanks! </p>
  
  <p> I'm using VS express 2008 C++</p>