Problems with linking files
Hello to everyone.
I am still a beginner in Qt and I have some problems in linking the different files of the project.
I am just copying the Qt Simple Tree Model Example. The only change I made was introducing a MainWindow, with its header, to organize the application.
However, I have the following errors :
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl TreeModel::TreeModel(class QString const &,class QObject *)" (??0TreeModel@@QEAA@AEBVQString@@PEAVQObject@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: virtual __cdecl TreeModel::~TreeModel(void)" (??1TreeModel@@UEAA@XZ) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
debug\Tree_Gui.exe:-1: error: LNK1120: 2 unresolved externals
I don’t know where the error is. I have included the corresponding files.
Someone can help me?
Can you post your code please ?
first you need execute qmake
@tujiaw Thank you very much for your help. That seems to work.
However, I would like to know the reason why I have to run qmake before building.
@ChusMatesanz qmake uses the information within the *.pro file to generate Makefiles that contain all the commands that are needed to build each project.
When you build a project and no makefiles are found, they are created, but if some are found, it skips this part. It even tells you so in the compiler out put
..skipping qmake step. So changes, like linking files, are not neccessarly taken care of.