Title says all. The error is
Error 1 error LNK2019: unresolved external symbol "private: void __thiscall Salsa::getTotal(void)" (?getTotal@Salsa@@AAEXXZ) referenced in function "public: void __thiscall Salsa::getSold(void)" (?getSold@Salsa@@QAEXXZ)
Error 2 error LNK2019: unresolved external symbol "private: void __thiscall Salsa::getHigh(void)" (?getHigh@Salsa@@AAEXXZ) referenced in function "public: void __thiscall Salsa::getSold(void)" (?getSold@Salsa@@QAEXXZ)
Error 3 error LNK2019: unresolved external symbol "private: void __thiscall Salsa::getLow(void)" (?getLow@Salsa@@AAEXXZ) referenced in function "public: void __thiscall Salsa::getSold(void)" (?getSold@Salsa@@QAEXXZ)
Error 4 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup Chips And Salsa Class
The code is as follows; .h file, then .cpp;
#ifndef SALSA_H
#define SALSA_H
class Salsa
{
private:
void getTotal();
void getHigh();
void getLow();
int count;
int total;
int highest;
int lowest;
int flavor;
public:
void getSold();
};
#endif
And now the .cpp;
#include "Salsa.h"
#include <iostream>
#include <string>
using namespace std;
void Salsa::getSold()
{
for (count = 0; count < 5; count++)
{
cout << "Jar sold last month of ";
cout << count + 1;
cin >> flavor;
while (flavor <= 0)
{
cout << "Jars sold must be greater than or equal to 0.";
cout << "Re-enter jars sold for last month ";
cin >> flavor;
cout << endl;
}
Salsa::getTotal();
Salsa::getHigh();
Salsa::getLow();
}
Salsa::getTotal();
total = 0;
for (count = 0; count < 5; count++)
{
total += flavor;
cout << "Total Sales: " << total << endl;
}
Salsa::getHigh();
{
highest = flavor;
int index = 1;
for (count = 0; count < 5; count++)
if (flavor > highest)
{
highest = flavor;
index = count + 1;
}
cout << "High Seller: " << flavor << endl;
}
Salsa::getLow();
{
lowest = flavor;
int index = 1;
for (count = 0; count < 5; count++)
{
if (flavor < lowest)
{
lowest = flavor;
index = count + 1;
}
cout << "Low Seller: " << flavor << endl;
}
int main();
{
const int SALS_FLAV = 5;
string flavor[SALS_FLAV] = { "mild", "medium", "sweet", "hot", "zesty" };
Salsa sold;
for (int index = 0; index < SALS_FLAV; index++)
{
sold.getSold();
}
}
}
}
Salsa::getSold
seems to be inside that method. Thus none of the other methods has been defined. – tsnorri