Can someone please help me with this error I am getting when compiling:
DivSales.obj : error LNK2001: unresolved external symbol "private: static int DivSales::totalSales" (?totalSales@DivSales@@0HA)
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
1>C:\...\Week 3 - Challenge 7\Debug\Week 3 - Challenge 7.exe : fatal error LNK1120: 2 unresolved externals
Here is my code:
DivSales.h:
class DivSales
{
public:
DivSales();
void addTotal(int a, int b, int c, int d);
int printValue(const int t = 2);
int quartSales[4];
private:
static int totalSales;
};
DivSales.cpp
#include "DivSales.h"
#include <iostream>
using namespace std;
void DivSales::addTotal(int a, int b, int c, int d)
{
cout << "Enter 1st Quarter:" << endl;
cin >> a;
cout << "Enter 2nd Quarter:" << endl;
cin >> b;
cout << "Enter 3rd Quarter:" << endl;
cin >> c;
cout << "Enter 4th Quarter:" << endl;
cin >> d;
quartSales[0] = a;
quartSales[1] = b;
quartSales[2] = c;
quartSales[3] = d;
totalSales = (a+b+c+d);
}
int DivSales::printValue(const int t)
{
return quartSales[t];
}
RunDivSales.cpp
#include "DivSales.h"
#include <iostream>
using namespace std;
int main(void)
{
DivSales divSales;
divSales.addTotal();
divSales.printValue()
cin.get();
}
Thank you for the help.