Hi. i 'm learning C++...Now i need some help for my code because i get this error
error LNK2019: unresolved external symbol "public: __thiscall Parkedcar::Parkedcar(void)" (??0Parkedcar@@QAE@XZ) referenced in function _wmain
1>C:\Users\jackkwok\Documents\Visual Studio 2005\Projects\KwokParking\Debug\KwokParking.exe : fatal error LNK1120: 1 unresolved externals
Please let me know how to fix this problem. thanks in advance
#ifndef PARKEDCAR_H
#define PARKEDCAR_H
#include <iostream>
#include <string>
using namespace std;
class Parkedcar
{
private:
string make; // Holds make of parked car
string model; // Holds model of parked car
string color; // Holds color of parked car
string licNum; // Holds license number of parked car
int minParked; // Holds minutes of parked car
public:
Parkedcar(); // Constructor
void setMake(string pcMake)
{
make = pcMake;
}
void setModel(string pcModel)
{
model = pcModel;
}
void setColor(string pcColor)
{
color = pcColor;
}
void setLicNum(string pcLicNum)
{
licNum = pcLicNum;
}
void setMinParked(int pcMin)
{
minParked = pcMin;
}
string getMake()
{
return make;
}
string getModel()
{
return model;
}
string getColor()
{
return color;
}
string getLicNum()
{
return licNum;
}
int getMinParked()
{
return minParked;
}
};
#endif
#ifndef PARKINGMETER_H
#define PARKINGMETER_H
#include <string>
#include <iostream>
using namespace std;
class ParkingMeter
{
private:
int minPurchased;
public:
ParkingMeter(int mPurchased)
{
minPurchased = mPurchased;
}
void setMinutesPurchased(int mPurchased)
{
minPurchased = mPurchased;
}
int getMinPurchased()
{
return minPurchased;
}
void print ()const
{
cout << " Minutes of parking time that has been purchased: " << endl;
}
};
#endif
#ifndef PARKINGTICKET_H
#define PARKINGTICKET_H
#include <iostream>
#include <string>
using namespace std;
class ParkingTicket
{
private:
string make; // Holds make of parked car
string model; // Holds make of parked car
string color; // Holds make of parked car
string licNum; // Holds make of parked car
string officerName; // Holds name of police officer
string badgeNum; // Holds badge number of police officer
int minParked; // Holds time that car has been parked
int minPurchased; // Holds time purchased at parking meter
int difference; // Holds time
public:
ParkingTicket();
void setMake(string ptMake)
{
make = ptMake;
}
void setModel(string ptModel)
{
model = ptModel;
}
void setColor(string ptColor)
{
color = ptColor;
}
void setLicNum(string ptLicNum)
{
licNum = ptLicNum;
}
void setOfficerName(string ptOffName)
{
officerName = ptOffName;
}
void setBadgeNum(string ptBadgeNum)
{
badgeNum = ptBadgeNum;
}
void setMinParked(int minPark)
{
minParked = minPark;
}
void setMinPurchased(int minPurchase)
{
minPurchased = minPurchase;
}
void setDifference(int diff)
{
difference = diff;
}
string getMake()
{
return make;
}
string getModel()
{
return model;
}
string getColor()
{
return color;
}
string getLicNum()
{
return licNum;
}
string getOfficerName()
{
return officerName;
}
string getBadgeNum()
{
return badgeNum;
}
int getMinParked()
{
return minParked;
}
int getMinPurchased()
{
return minPurchased;
}
int getDifference()
{
return difference;
}
};
#endif
#ifndef POLICEOFFICER_H
#define POLICEOFFICER_H
#include <iostream>
#include <string>
using namespace std;
class PoliceOfficer
{
private:
string officerName; // Holds name of police officer
string badgeNum; // Holds badge number of police officer
public:
PoliceOfficer();
void setOfficerName(string poOffName)
{
officerName = poOffName;
}
void setBadgeNum(string poBadgeNum)
{
badgeNum = poBadgeNum;
}
string getOfficerName()
{
return officerName;
}
string getBadgeNum()
{
return badgeNum;
}
};
#endif
cpp.file
#include "stdafx.h"
#include "ParkingMeter.h"
#include "Parkedcar.h"
#include "Parkingticket.h"
#include "PoliceOfficer.h"
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Create a Car object.
Parkedcar car;
car.setMake("Ford");
car.setModel("Mustang");
car.setColor("Purple");
car.setLicNum("JKL123");
car.setMinParked(125);
return 0;
cout << " Make: " << car.getMake() << endl;
cout << " Model: " << car.getModel() << endl;
cout << " Color: " << car.getColor() << endl;
cout << " License Number: " << car.getLicNum() << endl;
cout << " Minutes Parked: " << car.getMinParked() << endl;
}