Hello,
It seems like every time I start a new project with classes I have trouble with this.
I am getting an error "undefined reference to 'Item::Item()'
I'm sure I am overlooking a simple mistake. I have been looking at this for an hour and I cannot seem to find a problem with my code.
#include "utility.h"
#include "Item.h"
using namespace std;
int main()
{
cout << "beginning" << endl;
Item test;
cout << "middle" << endl;
test.makeItem(3, "Dallas");
cout << "end" << endl;
}
#ifndef UTILITY_H
#define UTILITY_H
//Gives ANSI version of standard includes
//Also defines enumerated type for error
//messages
#include <iostream>
#include <limits>
#include <cmath>
#include <cstdlib>
#include <cstddef>
#include <fstream>
#include <cctype>
#include <ctime>
#include <string>
using namespace std;
enum Error_code { success, fail, exceeds_range,
not_present, duplicate_error, underflow, overflow };
#endif //UTILITY_H
#ifndef ITEM_H
#define ITEM_H
class Item
{
public:
void makeItem(int arrival, string dest);
private:
int arrivalTime;
string destination;
};
#endif // ITEM_H
#include "utility.h"
#include "Item.h"
/*
Item::Item()
{
}// End constructor
Item::~Item()
{
}// End destructor
*/
void Item::makeItem(int arrival, string dest)
{
arrivalTime = arrival;
destination = dest;
}// End makeItem