This is the image of my error.
This is my header/cpp file.
PCB.cpp
#include "PCB.h"
PCB::PCB(){
PID = 0;
filename = " ";
memStart = 0;
cdrw = " ";
filelength = 0;
}
PCB::PCB(int p, string fn, int m, string rw, int fl){
PID = p;
filename = fn;
memStart = m;
cdrw = rw;
filelength = fl;
}
void PCB::getParam(){
cout << PID << " " << filename << " " << memStart << " " << cdrw << " " << filelength << endl;
}
void PCB::setPID(int p){
PID = p;
}
void PCB::setFile(string name){
filename = name;
}
void PCB::setCDRW(string rw){
cdrw = rw;
}
void PCB::setMem(int m){
memStart = m;
}
void PCB::setLength(int l){
filelength = l;
}
int PCB::returnPID(){
return PID;
}
string PCB::returnFile(){
return filename;
}
int PCB::returnMem(){
return memStart;
}
string PCB::returnRW(){
return cdrw;
}
int PCB::returnLength(){
return filelength;
}
PCB.h
#ifndef PCB_H
#define PCB_H
#include<string>
#include<iostream>
using namespace std;
class PCB
{
private:
int PID;
string filename;
int memStart;
string cdrw;
int filelength;
public:
PCB();
PCB(int, string, int, string, int);
//setters
void setPID(int);
void setFile(string);
void setMem (int);
void setCDRW (string);
void setLength (int);
//getters
void getParam();
int returnPID();
string returnFile();
int returnMem();
string returnRW();
int returnLength();
};
#endif // PCB_H
I'm getting a Multiple Definition error and I have no idea why. Is it because I'm using namespace std or is it because of something else? I normally overload my constructors. I'm really confused.