Just started using Qt and come across an error, wonder if someone could shed some light on the issue. Googled about and looked at similar questions but cant seem to get a solution;
C:\Users\Seb\Desktop\SDIcw2\main.cpp:10: error: undefined reference to `SDI::shipHandler::shipHandler(SDI::shipHandler&)'
occurs at line 10, the " w.populateCombo(shipHandler);" in my main.cpp;
#include "widget.h"
#include <QApplication>
#include "shipHandler.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
SDI::shipHandler shipHandler("ships/ships.txt");
w.populateCombo(shipHandler);
return a.exec();
}
shipHandler.cpp (constructor & destructor)
SDI::shipHandler::shipHandler(std::string fileName)
{
shipCount = 0;
std::string line;
std::ifstream infile;
infile.open(fileName.c_str());
while(!infile.eof())
{
getline(infile,line);
shipHandler::lineParse(line);
shipCount++;
}
infile.close();
}
SDI::shipHandler::~shipHandler()
{
}
shipHandler.h
#ifndef SDI__shipHandler
#define SDI__shipHandler
#include "common.h"
#include "navalVessels.h"
namespace SDI
{
class shipHandler
{
//variables
public:
std::vector<SDI::navalVessels*> ships;
int shipCount;
private:
//function
public:
shipHandler();
shipHandler(std::string fileName);
shipHandler(SDI::shipHandler& tbhCopied);
~shipHandler();
void lineParse(std::string str);
void construct(std::vector<std::string> line);
std::vector<int> returnDates(std::string dates);
private:
};
}
#endif
Any help is appreciated