I have been trying to figure out where this is comming from:
1>main.obj : error LNK2019: unresolved external symbol "public: void __thiscall StudentList::getStream(class std::basic_ifstream<char,struct std::char_traits<char> > *)" (?getStream@StudentList@@QAEXPAV?$basic_ifstream@DU?$char_traits@D@std@@@std@@@Z) referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall StudentData::StudentData(void)" (??0StudentData@@QAE@XZ) referenced in function "public: __thiscall StudentList::StudentList(void)" (??0StudentList@@QAE@XZ)
one of them is realted to the
list.getStream(dataStream);
line of code just before "return 0;", because when ever I comment it out, one of the error messages dissappears.
Here is the main function:
#include "InFile.h"
#include "StudentList.h"
int main()
{
char dataString[200]={"studentList10.csv"}; //Default name of file
ifstream *dataStream;
StudentList list;
InFile data;
//open file
data.openFile(dataString);
//and check that it is valid
if (data.fileOpenError())
{
cout << "ERROR" << endl
<< "File, " << dataString << " was not opened successfully" << endl;
exit( 1 );
}
else
{
cout << "File, " << dataString << " was opened successfully" << endl;
}
dataStream = data.getDataStream();
list.getStream(dataStream);
return 0;
}
I am pretty sure that InFile is not presenting issues, but whenever I uncomment two lines in the "StudentList.h" header file related to the "StudentData" class I get the other error.
Here are the respective header file for StudendList.h and StudentData.h
StudendList.h
#include "studentData.h"
#include <fstream>
using std::ifstream;
class StudentList
{
public:
void getRawRecord(char * record);
void getStream(ifstream * dStream);
void readRawRecord();
StudentData studentLongList[500];
private:
char * rawRecord;
StudentData tempStudent;
ifstream * data;
};
StudentData.h
#include <string>
using std::string;
class StudentData
{
public:
// Default constructor
StudentData();
//input constructor
StudentData(string lName, string fName, unsigned short idnt, string dCode, string sCode, string cCode);
//functions that access items which uniquely define a student
void setFirstName(string fName);
void setLastName(string lName);
void setID(int idnt);
string getFirstName();
string getLastName();
unsigned short getID();
//codes to define groups a student belongs to
//duo team, family, and club
void setDuoCode(string dCode);
void setSiblingCode(string sCode);
void setClubCode(string cCode);
string getDuoCode();
string getSiblingCode();
string getClubCode();
//if a student is competing in a category this value is true
bool persuasive;
bool oo;
bool oi;
bool dramatic;
bool humorous;
bool duo;
bool thematic;
bool impromptu;
bool extemporaneous;
bool apologetics;
/*this is for the list of other students competed against each
if you have competed in the same room as another student you
both have identical room codes
*/
string persuasiveRoomCode[10];
string ooRoomCode[10];
string oiRoomCode[10];
string dramaticRoomCode[10];
string humorousRoomCode[10];
string duoRoomCode[10];
string thematicRoomCode[10];
string impromptuRoomCode[10];
string extemporaneousRoomCode[10];
string apologeticsRoomCode[10];
/*this list defines the students average placement in room order
*/
float persuasiveRoomOrder;
float ooRoomOrder;
float oiRoomOrder;
float dramaticRoomOrder;
float humorousRoomOrder;
float duoRoomOrder;
float thematicRoomOrder;
float impromptuRoomOrder;
float extemporaneousRoomOrder;
float apologeticsRoomOrder;
private:
//this function is used for initializing category room codes
void categoryInitializer(bool category);
void roomCodeInitializer(string rCode[]);
void roomOrderInitializer(float rOrder);
//items which uniquely define a student
string firstName;
string lastName;
unsigned short ID;
//codes to define groups a student belongs to
//duo team, family, and club
string duoCode;
string siblingCode;
string clubCode;
};