I am making a simple C++ program in Eclipse that makes a CastEmission and a LiveEmission object and fills in the information from a text file. When I compile it, this error occurs "symbol(s) not found for architecture x86_64".
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
using std::cin;
using std::cout;
using std::string;
using std::ifstream;
class Emission {
private:
string title;
string description;
int idNumber;
string tvProducer;
string live;
Emission* next;
public:
Emission(ifstream *myInput){
char data[200];
string idNumStr;
myInput->getline(data, 200);
idNumStr = strtok(data, "<>");
idNumber= stoi(idNumStr, NULL, 10);
title = strtok(NULL, "<>");
description = strtok(NULL, "<>");
tvProducer = strtok(NULL, "<>");
live = strtok(NULL, "<>");
next = NULL;
}
string GetTitle(){return title; }
string GetDescription(){return description; }
string GetTvProd(){ return tvProducer;}
string GetLive(){ return live;}
int GetId(){ return idNumber; }
Emission* GetNext(){ return next;}
void SetNext(Emission* temp){
next = temp;
}
virtual void PrintEmissionEvents(){
cout << ' ' << GetTitle() << ' ' << GetDescription()
<< ' ' <<GetTvProd() << ' ' << GetLive()
<< ' ' <<GetId() << " Emission\n";
}
virtual void PrintEmissionDetails() = 0;
virtual ~Emission(){}
//...
};
class LiveEmission : public Emission {
private:
//...
public:
LiveEmission(ifstream *myInput) : Emission(myInput){
}
virtual void PrintEmissionEvents(){
}
virtual void PrintEmissionDetails(){
cout << ' ' << GetTitle() << ' ' << GetDescription()
<< ' ' <<GetTvProd() << ' ' << GetLive()
<< ' ' <<GetId() << " live\n";
}
//...
};
class CastEmission : public Emission {
private:
//...
public:
CastEmission(ifstream *myInput) : Emission(myInput){
}
virtual void PrintEmissionEvents();
virtual void PrintEmissionDetails(){
cout << ' ' << GetTitle() << ' ' << GetDescription()
<< ' ' <<GetTvProd() << ' ' << GetLive()
<< ' ' <<GetId() << " cast\n";
}
//...
};
int main(){
ifstream myInputH("myIn.txt");
ifstream *myInput = &myInputH;
if(myInput->is_open()){
CastEmission cast1(myInput);
LiveEmission live2(myInput);
cast1.PrintEmissionDetails();
live2.PrintEmissionDetails();
}
else{
cout << "Error! File could not be opened.\n";
}
myInput->close();
return 0;
}
This is the input file:
<1>< Sportcast><something something><J K Smith><cast>
<2><Athlitiki Kuriaki><Milaei kai i koutsi maria><Vasilis Bakopoulos><live>