title: I get this error is Visual Studio C++ :: "error LNK2019: unresolved external symbol"
body: <p>I see there is no shortage of these on the site, but I am at my wits end to figure this out. It is a very simple program with only three file. When I attempt to compile the program I get the link error. All three files show in the solution explorer.</p>
  
  <p>Here is the output</p>
  
  <pre><code>1&gt;------ Build started: Project: Problem 2, Configuration: Debug Win32 ------
  1&gt;Build started 5/13/2013 8:33:06 PM.
  1&gt;InitializeBuildStatus:
  1&gt;  Touching "Debug\Problem 2.unsuccessfulbuild".
  1&gt;ClCompile:
  1&gt;  Main.cpp
  1&gt;  DayOfYear.cpp
  1&gt;  Generating Code...
  1&gt;ManifestResourceCompile:
  1&gt;  All outputs are up-to-date.
  1&gt;Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall DayOfYear::print(void)" (?print@DayOfYear@@QAEXXZ) referenced in function _main
  1&gt;C:\Users\DigiVision\Desktop\School\CS-150-01\W11CH11\Problem 2\Debug\Problem 2.exe : fatal error LNK1120: 1 unresolved externals
  1&gt;
  1&gt;Build FAILED.
  1&gt;
  1&gt;Time Elapsed 00:00:01.72
  ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  </code></pre>
  
  <p>Here are the three files</p>
  
  <p><strong>Main.cpp</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "DayOfYear.h"
  
  using namespace std;
  
  int main()
  {
      int num;
      do
      {
          cout &lt;&lt; "Enter a number (-1 to escape): ";
          cin &gt;&gt; num;
          if (num != -1)
          {
              DayOfYear day(num);
              day.print();
          }
          cout &lt;&lt; endl;
      } while (num !=-1);
  
      cout &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p><strong>DayOfYear.cpp</strong></p>
  
  <pre><code>#include "DayOfYear.h"
  #include &lt;iostream&gt;
  
  using namespace std;
  
  int number;
  
  DayOfYear::DayOfYear(int n)
  {
      number = n;
  }
  
  void print()
  {
      const char * const month[12] = {"January","February","March","April","May","June",
                          "July","August","September","October","November","December"};
  
      if (number &lt; 32) // Jan
          cout &lt;&lt; month[0] &lt;&lt; " " &lt;&lt; number;
      else if (number &lt; 60) // Feb
          cout &lt;&lt; month[1] &lt;&lt; " " &lt;&lt; 60 - number;
      else if (number &lt; 91) // Mar
          cout &lt;&lt; month[2] &lt;&lt; " " &lt;&lt; 91 - number;
      else if (number &lt; 121) // Apr
          cout &lt;&lt; month[3] &lt;&lt; " " &lt;&lt; 121 - number;
      else if (number &lt; 152) // May
          cout &lt;&lt; month[4] &lt;&lt; " " &lt;&lt; 152 - number;
      else if (number &lt; 182) // Jun
          cout &lt;&lt; month[5] &lt;&lt; " " &lt;&lt; 182 - number;
      else if (number &lt; 213) // Jul
          cout &lt;&lt; month[6] &lt;&lt; " " &lt;&lt; 213 - number;
      else if (number &lt; 244) // Aug
          cout &lt;&lt; month[7] &lt;&lt; " " &lt;&lt; 244 - number;
      else if (number &lt; 274) // Sep
          cout &lt;&lt; month[8] &lt;&lt; " " &lt;&lt; 274 - number;
      else if (number &lt; 305) // Oct
          cout &lt;&lt; month[9] &lt;&lt; " " &lt;&lt; 305 - number;
      else if (number &lt; 335) // Nov
          cout &lt;&lt; month[10] &lt;&lt; " " &lt;&lt; 335 - number;
      else if (number &lt; 366) // Dec
          cout &lt;&lt; month[11] &lt;&lt; " " &lt;&lt; 366 - number;
  }
  </code></pre>
  
  <p><strong>DayOfYear.h</strong></p>
  
  <pre><code>#ifndef DAYOFYEAR_H
  #define DAYOFYEAR_H
  
  class DayOfYear
  {
  private:
      int number;
  public:
      DayOfYear()
      {
          number = 0;
      }
      DayOfYear(int);
      void print();
  };
  
  #endif
  </code></pre>