2012-07-25 1 views
0

J'ai écrit un petit algorithme de traitement d'image à l'aide de la bibliothèque CImg et l'ai regroupé dans une application de ligne de commande à l'aide de Visual C++ Express. Tout compilé sans erreur et s'est bien déroulé, jusqu'à ce que l'ingénieur en charge du projet décide qu'il voulait une interface graphique. Donc je suis allé à Qt et Qt créateur. L'interface graphique fonctionne bien par elle-même, mais tout l'enfer se déchaîne lorsque je déplace mon algorithme de traitement d'image.Erreurs de liaison dans Qt Creator 2.4.1 associé à la bibliothèque CImg

mainwindow.obj : error LNK2019: unresolved external 
[email protected] referenced in function "char const * __cdecl 
cimg_library::cimg::programfiles_path(char const * const,bool)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol 
[email protected] referenced in function "public: static int __cdecl 
cimg_library::CImgDisplay::screen_width(void)" 
([email protected]@[email protected]@SAHXZ) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected]  
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall 
cimg_library::CImgDisplay::assign(void)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol 
[email protected] referenced in function "public: void __thiscall 
cimg_library::CImgDisplay::_desinit_fullscreen(void)" 
([email protected]@[email protected]@QAEXXZ) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall 
cimg_library::CImgDisplay::resize(int,int,bool)" 
([email protected]@[email protected]@[email protected][email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall 
cimg_library::CImgDisplay::resize(int,int,bool)" 
([email protected]@[email protected]@[email protected][email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] referenced 
in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol 
[email protected] referenced in function "public: static unsigned long 
__stdcall cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static unsigned long __stdcall 
cimg_library::CImgDisplay::_events_thread(void *)" 
([email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: static long __stdcall 
cimg_library::CImgDisplay::_handle_events(struct HWND__ *,unsigned int,unsigned 
int,long)" ([email protected]@[email protected]@[email protected]@[email protected]) 

mainwindow.obj : error LNK2019: unresolved external symbol [email protected] 
referenced in function "public: struct cimg_library::CImgDisplay & __thiscall 
cimg_library::CImgDisplay::paint(void)" ([email protected]@[email protected]@[email protected]) 

debug\final.exe : fatal error LNK1120: 20 unresolved externals 

NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC 
\BIN\link.EXE"' : return code '0x460' 

Stop. 

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC 
\BIN\nmake.exe"' : return code '0x2' 

Stop. 

Mon problème maintenant, c'est que je ne sais pas pourquoi j'ai des problèmes de liaison. La bibliothèque CImg est un fichier H unique. Cela fait partie du projet et inclus. Je sais que Qt Creator a besoin de bibliothèques ajoutées au fichier de projet, mais qu'y a-t-il à ajouter? Ma bibliothèque est déjà répertoriée sous en-têtes.

Voici le fichier de projet.

QT  += core gui 

TARGET = final 
TEMPLATE = app 


SOURCES += main.cpp\ 
     mainwindow.cpp 

HEADERS += mainwindow.h \ 
    C:/includes/CImg.h 

FORMS += mainwindow.ui 

INCLUDEPATH += C:\includes\ 

Merci pour l'aide, je suis avant tout un programmeur de systèmes embarqués et de travail hors de mon élément C et l'assemblage devient très frustrant.

Répondre

0

Vous devez lier la bibliothèque Cimg à votre programme d'interface graphique. Ajoutez la bibliothèque dans votre fichier .pro.

LIBS += -L$PATH_TO_CIMG_LIB -l$CIMG_LIB 
+0

Lorsque j'ajoute cette ligne, il essaie d'ajouter CIMG_LIB.lib, qui n'existe pas. La raison pour laquelle je suis si confus est le fait que CImg est contenu dans un seul fichier H. L'inclure devrait suffire. Cela passe par le préprocesseur, le compilateur et l'assembleur. Pourquoi lance-t-il le drapeau à l'éditeur de liens? –

+1

Je suis désolé. Je ne sais pas Cimg est compilé avec votre code source, à la place d'une bibliothèque statique par linked. Le symbole non résolu est dans la bibliothèque Windows SDK. Réessayez ce 'LIBS + = -lAdvapi32 -lgdi32 -luser32 -lshell32'. –

0

Essayez de compiler le fichier d'en-tête de CIMG à une bibliothèque statique et utiliser (libs + = ... youtstaticlibrary) j'utilise visual studio donc je ne peux pas vous aider comment ajouter de la qt bibliothèque, comprendre que votre auto. Étapes de compilation en bibliothèque statique par exemple créer un projet CIMG_LIB (projet de console) (ou n'importe quel nom que vous aimez) et dans votre fichier source inclure en-tête cimg. utilisation cimg_library d'espace de noms dans le code source (ne rien ajouter d'autre ici) compiler le projet à la bibliothèque statique

-> créer projet GUI avec qt incluent fichier d'en-tête dans votre projet ajouter bibliothèque que vous avez déjà créé .. et ur bien aller.

Questions connexes