In a nutshell, you used a function which is declared but not defined.
It should be caused by your classes using Qt functionality (like signal-slots) but incorrectly.
Here's possibilities I can think of:
3-a. Double check you've written "Q_OBJECT" at the beginning of your class that use Qt functionality.
3-b. You call "moc" property, i.e. check if your Qt Visual Studio plugin is installed and enabled.
Linker errors LNK2001 and LNK2019
-
27-09-2022 - |
Question
I am compiling my Qt project using compiler MSVC2008, and I am getting linker errors like-
_class_name.obj_:error LNK2001: unresolved external symbol "public: static struct QMetaObject...."... referenced in a function "_function_name_"
_class_name.obj_:error LNK2019: unresolved external symbol "public: static struct QMetaObject..." ... referenced in a function "_function_name_"
I have few basic queries-
what does it mean by errors LNK2001 and LNK2019?
Why these error occurs?
How to resolve these?
NOTE: I am using QtCreater so build system uses qmake and compiler used is MSVC2008.
La solution
Autres conseils
You've included the wrong/too little files or forgot to add .lib files to the Linker in msvc.
Check under linker's Additional Dependencies
property for:
QtCore5.lib
- for Qt5 Release
QtCore5d.lib
- for Qt5 Debug
QMetaObject
is included in one of those, but they might not be the only dependencies in your project.