This is my main.cpp. My program starts here and this is where I have the problem:
I get two errors:
undefined reference to `BankController::BankController(TransactionRepository)* at line 23
and
undefined reference to `TransactionFileRepository::TransactionFileRepository(std::string) at line 19
For both of them, the type is C/C++ Problem, resource is main.cpp
#include "bankgui.h" #include "Controller/BankController.h" #include "Repository/TransactionFileRepository.h" #include "Repository/TransactionMemoryRepository.h" #include "Repository/TransactionRepository.h" #include <QtGui> #include <QApplication> #include <string> #include <iostream> using namespace std; int main(int argc, char *argv[]){ string path = "DataStorage/Database.txt"; //Instantiate the main data repository TransactionRepository* mainDatabase; mainDatabase = new TransactionFileRepository(path); // <-- Error here //Instantiate the main controller BankController* mainController; mainController = new BankController(mainDatabase); // <-- Same Error here //Starts the GUI QApplication app(argc, argv); BankGUI* mainWidget; mainWidget = new BankGUI(mainController); mainWidget->show(); return app.exec(); }
I have 3 classes:
a virtual TransactionRepository
one class that implements the above TransactionMemoryRepository
one class that inherits the above TransactionMemoryRepository into TransactionFileRepository
I've been searching for several hours on google for solutions but everything I try doesn't get rid of those errors.
I should mention that this is a C++ QT project that I am working on. I had to add to the project properties the include paths for some things to work.
All files that are #included exist.