title: C++ LNK1120 and LNK2019 errors: "unresolved external symbol WinMain@16"
body: <p>I'm trying to do another exercise from Deitel's book. The program calculates the monthly interest and prints the new balances for each of the savers. As the exercise is part of the chapter related to dynamic memory, I'm using "new" and "delete" operators. For some reason, I get these two errors:</p>
  
  <blockquote>
    <p>LNK2019: unresolved external symbol  WinMain@16 referenced in function ___tmainCRTStartup</p>
    
    <p>fatal error LNK1120: 1 unresolved externals</p>
  </blockquote>
  
  <p>Here is class header file.</p>
  
  <pre><code>//SavingsAccount.h
  //Header file for class SavingsAccount
  
  class SavingsAccount
  {
  public:
      static double annualInterestRate;
  
      SavingsAccount(double amount=0);//default constructor intialize  
                                          //to 0 if no argument
  
    double getBalance() const;//returns pointer to current balance
    double calculateMonthlyInterest();
    static void modifyInterestRate(double interestRate):
  
    ~SavingsAccount();//destructor
  
  private:
      double *savingsBalance;
  };
  </code></pre>
  
  <blockquote>
    <p>Cpp file with member function definitions</p>
  </blockquote>
  
  <pre><code>//SavingsAccount class defintion
  #include "SavingsAccount.h"
  
  double SavingsAccount::annualInterestRate=0;//define and intialize static data
                                          //member at file scope
  
  
  SavingsAccount::SavingsAccount(double amount)
  :savingsBalance(new double(amount))//intialize savingsBalance to point to new object
  {//empty body
  }//end of constructor
  
  double SavingsAccount::getBalance()const
  {
      return *savingsBalance;
  }
  
  double SavingsAccount::calculateMonthlyInterest()
  {
      double monthlyInterest=((*savingsBalance)*annualInterestRate)/12;
  
      *savingsBalance=*savingsBalance+monthlyInterest;
  
      return monthlyInterest;
  }
  
  void SavingsAccount::modifyInterestRate(double interestRate)
  {
      annualInterestRate=interestRate;
  }
  
  SavingsAccount::~SavingsAccount()
  {
      delete savingsBalance;
  }//end of destructor
  </code></pre>
  
  <blockquote>
    <p>End finally driver program :</p>
  </blockquote>
  
  <pre><code>#include &lt;iostream&gt;
  #include "SavingsAccount.h"
  
  using namespace std;
  
  int main()
  {
  SavingsAccount saver1(2000.0);
  SavingsAccount saver2(3000.0);
  
  SavingsAccount::modifyInterestRate(0.03);//set interest rate to 3%
  
  cout&lt;&lt;"Saver1 monthly interest: "&lt;&lt;saver1.calculateMonthlyInterest()&lt;&lt;endl;
  cout&lt;&lt;"Saver2 monthly interest: "&lt;&lt;saver2.calculateMonthlyInterest()&lt;&lt;endl;
  
  cout&lt;&lt;"Saver1 balance: "&lt;&lt;saver2.getBalance()&lt;&lt;endl;
  cout&lt;&lt;"Saver1 balance: "&lt;&lt;saver2.getBalance()&lt;&lt;endl;
  
  return 0;
  }
  </code></pre>
  
  <p>I have spent an hour trying to figure this out with no success.</p>