1

I am having problems linking a test project; this is the error:

DataGUI.obj:-1: error: LNK2019: unresolved external symbol "public: __cdecl GuiUtilities::TreeModel::TreeModel(class QObject *)" (??0TreeModel@GuiUtilities@@QEAA@PEAVQObject@@@Z) referenced in function "public: __cdecl GuiUtilities::DataGUI::DataGUI(class QWidget *)" (??0DataGUI@GuiUtilities@@QEAA@PEAVQWidget@@@Z)

File not found: DataGUI.obj

The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project DataGUI (kit: Desktop Qt 5.8.0 MSVC2015_64bit)
The kit Desktop Qt 5.8.0 MSVC2015_64bit has configuration issues which might be the root cause for this problem.

The object file 'DataGUI.obj' does exist.

I am doing an out of source build, and so:

./Project/sources
./Project/*.pro
./Build/build-Project-.../Debug/DataGUI.obj

With the exact same configuration, I have already built other Qt projects successfully.

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • Does the error still persist after you "Clear" the project, and build it again? – Danyright May 12 '17 at 10:43
  • @Danyright: Yes, I keep getting the same error. – Pietro May 12 '17 at 10:44
  • Ok. Then I would check your code. Is it possible that you somehow don't link properly (#include) the TreeModel class? Can you publish DataGUI's code? – Danyright May 12 '17 at 10:48
  • Just a moment, something strange happened. I switched from Debug build to Release build, and I got many compile time errors I did not get before. Then I switched back to Debug build, and I kept getting all these errors. It must have been an issue with the build system... – Pietro May 12 '17 at 10:55

1 Answers1

1

This issue partially fixed itself, but I am leaving this question for reference in case the same thing should happen to others.

This is the sequence of events:

  • Working with the IDE in Debug mode.
  • The program compiled without any errors/warnings.
  • I got the linker error reported in the question.
  • Tried to rebuild the whole project multiple times, without success.
  • Set the IDE in Release mode.
  • Got many compile time errors.
  • Set the IDE back in Debug mode.
  • Got the same compile time errors as in Release mode.

Now I am fixing the compile time errors...

Pietro
  • 12,086
  • 26
  • 100
  • 193