I am getting this error message repeatedly and I do not know why. I have tried looking online and have found that this error message comes from the linker, not the compiler, and it is trying to tell me that I have not linked against the library or object code. Maybe I'm missing a variable? I don't know.
Here is the code:
class foodType
{
public:
void set(string, int, double, int, double, double);
void print() const;
foodType(string = "", int = 0, double = 0.0, int = 0, double = 0.0, double = 0.0);
private:
string name;
int calories;
double fat;
int sugar;
double carbohydrate;
double potassium;
};
foodType apple;
int main()
{
apple.set( "Apple" , 100, 0.10, 10, 100.00, 0.02);
apple.print();
return 0;
}
void foodType::set(string fruitName, int Cal, double fats,
int sug, double carbs, double K)
{
name = fruitName;
calories = Cal;
fat = fats;
sugar = sug;
carbohydrate = carbs;
potassium = K;
}
void foodType::print() const
{
cout << "Fruit is: " << name << endl;
cout << "Calories: " << calories << endl;
cout << "Fat content: " << fat << endl;
cout << "Sugar content: " << sugar << endl;
cout << "Carbs: " << carbohydrate << endl;
cout << "Potassium: " << potassium << endl;
}