J'ai des problèmes lors de la construction de OpenCV_HighGui220d.lib avec le support QT. Les problèmes sont les symboles non résolus sur QMetaObject, tels que:Symboles non résolus QMetaObject lors de la construction d'OpenCV avec support QT
public: virtual struct QMetaObject const * __thiscall GuiReceiver::metaObject(void)const ([email protected]@@[email protected]@XZ)
Mes environnements:
- Visual Studio 2010
- OpenCV 2.2
- QT SDK Version: 4.7.3
Ci-dessous sont mes étapes de construction:
1. utiliser CMake pour ouvrir C:\OpenCV2.2
, vérifier WITH_QT et WITH_QT_OPENGL, génère des fichiers vcxproj et sln.
2. AJOUTZ macros dans cvconfig.h
:
#define HAVE_QT
#define HAVE_QT_OPENGL
3. ajouter window_QT.cpp dans le fichier opencv_highgui.vcxproj dans VS2010 et ajouter ci-dessous des macros dans window_QT.cpp
#define QT_LARGEFILE_SUPPORT
#define QT_DLL
#define QT_GUI_LIB
#define QT_CORE_LIB
#define QT_HAVE_MMX
#define QT_HAVE_3DNOW
#define QT_HAVE_SSE
#define QT_HAVE_MMXEXT
#define QT_HAVE_SSE2
#define QT_THREAD_SUPPORT
J'ai essayé aussi de remplacer
QT_DLL avec
QT_NODLL, mais n'a pas réussi.
4. Ajoutez le répertoire
C:/QtSDK/Desktop/Qt/4.7.3/msvc2008/lib
dans les répertoires de bibliothèques supplémentaires dans les pages de propriétés du lien.
5. Ajouter ci-dessous dans les bibliothèques Dépendances supplémentaires:
qtmain.lib
qtmaind.lib
QtGui4.lib
QtGuid4.lib
QtCore4.lib
QtCored4.lib
QtOpenGL4.lib
QtOpenGLd4.lib
Qt3Support4.lib
Qt3Supportd4.lib
QtHelp4.lib
QtHelpd4.lib
QtDesigner4.lib
QtDesignerd4.lib
QAxContainer.lib
QAxContainerd.lib
phonon4.lib
phonond4.lib
QAxServer.lib
QAxServerd.lib
QtDeclarative4.lib
QtDeclaratived4.lib
QtDesignerComponents4.lib
QtDesignerComponentsd4.lib
QtMultimedia4.lib
QtMultimediad4.lib
QtNetwork4.lib
QtNetworkd4.lib
QtScript4.lib
QtScriptd4.lib
QtScriptTools4.lib
QtScriptToolsd4.lib
QtSql4.lib
QtSqld4.lib
QtSvg4.lib
QtSvgd4.lib
QtTest4.lib
QtTestd4.lib
QtUiTools.lib
QtUiToolsd.lib
QtWebKit4.lib
QtWebKitd4.lib
QtXml4.lib
QtXmld4.lib
QtXmlPatterns4.lib
QtXmlPatternsd4.lib
6. Enfin, les rapports de l'éditeur de liens d'erreur:
------ Build started: Project: ZERO_CHECK, Configuration: Debug Win32 ------
------ Build started: Project: opencv_highgui, Configuration: Debug Win32 ------
Creating library C:/OpenCV2.2/Build_QT/lib/Debug/opencv_highgui220d.lib and object C:/OpenCV2.2/Build_QT/lib/Debug/opencv_highgui220d.exp
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall GuiReceiver::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall GuiReceiver::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall GuiReceiver::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvTrackbar::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvTrackbar::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvTrackbar::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const CvTrackbar::staticMetaObject" ([email protected]@@[email protected]@B)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvButtonbar::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvButtonbar::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvButtonbar::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const CvButtonbar::staticMetaObject" ([email protected]@@[email protected]@B)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvPushButton::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvPushButton::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvPushButton::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvCheckBox::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvCheckBox::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvCheckBox::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvRadioButton::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvRadioButton::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvRadioButton::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvWinProperties::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvWinProperties::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvWinProperties::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall CvWindow::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall CvWindow::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall CvWindow::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const CvWindow::staticMetaObject" ([email protected]@@[email protected]@B)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __thiscall ViewPort::metaObject(void)const " ([email protected]@@[email protected]@XZ)
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual void * __thiscall ViewPort::qt_metacast(char const *)" ([email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ViewPort::qt_metacall(enum QMetaObject::Call,int,void * *)" ([email protected]@@[email protected]@@[email protected])
window_QT.obj : error LNK2001: unresolved external symbol "public: static struct QMetaObject const ViewPort::staticMetaObject" ([email protected]@@[email protected]@B)
C:\OpenCV2.2\Build_QT\bin\Debug\opencv_highgui220d.dll : fatal error LNK1120: 31 unresolved externals
========== Build: 1 succeeded, 1 failed, 8 up-to-date, 0 skipped ==========
J'ai essayé la commande: 'qmake -tp vc -r opencv_highgui.vcxproj'. Cependant, il rapporte: 'opencv_highgui.vcxproj: 5: Parse Error'' (' Débogage Configuration>')' 'Erreur lors du traitement du fichier projet: opencv_highgui.vcxproj'. Il semble que qmake ne supporte pas VS2010? –
MikimotoH
Terminé. Après avoir essayé la commande ci-dessous pour "moc" manuellement window_QT.h avec Q_OBJECT, ce projet est construit avec succès. Commande: 'moc -I"% QTDIR% \ include "-I"% QTDIR% \ include \ QtCore "-I"% QTDIR% \ include \ QtGui "-omoc_window_QT.cpp window_QT.h' – MikimotoH
Lorsque vous configurez Qt manuellement, win32-msvc2008 est le plus haut descripteur Visual Studio qu'ils ont. Je ne sais pas si VS2010 diffère de manière significative. (Je suis sur VS2005.) Heureux d'entendre que votre problème a été résolu. – Gnawme