2012-07-25 2 views
0

CImg 라이브러리를 사용하여 작은 이미지 처리 알고리즘을 작성하고 Visual C++ Express를 사용하는 명령 줄 응용 프로그램에 번들로 제공했습니다. 프로젝트를 담당하는 엔지니어가 GUI를 원한다고 결정할 때까지 모든 것이 오류없이 컴파일되고 잘 돌아갔습니다. 그래서 나는 Qt와 Qt 제작자에게 갔다. GUI는 자체적으로 정상적으로 작동하지만 이미지 처리 알고리즘을 이동할 때 모든 지옥이 느슨해집니다.CImg 라이브러리와 연결된 Qt Creator 2.4.1의 링커 오류

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 __imp__Get[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. 

내 문제는 지금 왜 링커 문제가 있는지 잘 모르겠다는 것입니다. CImg 라이브러리는 단일 H 파일입니다. 그것은 프로젝트의 일부이며 포함되어 있습니다. Qt Creator가 프로젝트 파일에 추가 된 라이브러리를 필요로한다는 것을 알고 있습니다 만, 추가 할 부분은 무엇입니까? 내 라이브러리는 이미 헤더 아래에 나열되어 있습니다.

다음은 프로젝트 파일입니다.

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\ 

덕분에 도움, 나는 주로 임베디드 시스템 프로그래머 해요, 내 C 및 어셈블리 요소에서 작업하는 것은 매우 실망지고 있습니다.

답변

0

Cimg 라이브러리를 GUI 프로그램에 연결해야합니다. .pro 파일에 라이브러리를 추가하십시오.

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

해당 행을 추가하면 존재하지 않는 CIMG_LIB.lib를 추가하려고 시도합니다. 내가 이것 때문에 혼란스러워하는 이유는 CImg이 하나의 H 파일에 포함되어 있기 때문입니다. 그것을 포함하면 충분합니다. 전처리 기, 컴파일러 및 어셈블러를 통해이 작업을 수행합니다. 왜 링커에서 깃발을 던지고있는거야? –

+1

죄송합니다. Cimg가 링크로 정적 라이브러리로 대신 소스 코드로 컴파일되었는지는 모르겠다. 해결되지 않은 기호는 Windows SDK 라이브러리에 있습니다. 이'LIBS + = -lAdvapi32 -lgdi32 -luser32 -lshell32'를 다시 시도하십시오. –

0

시도 정적 라이브러리 에 CIMG 헤더 파일을 컴파일하고 사용 (libs와 + = ... youtstaticlibrary) 내가 그래서 난 도서관의 QT를 추가하는 방법을 도와 어차피 비주얼 스튜디오를 사용, 자기를 알아낼.

단계는 정적 라이브러리 으로 컴파일합니다. CIMG_LIB 프로젝트 (콘솔 프로젝트) (또는 원하는 이름) 을 만들고 소스 파일에 cimg 헤더가 포함되어 있는지 확인하십시오. 소스 코드에서 사용하는 네임 스페이스 cimg_library (다른 여기에 무엇을 추가 해달라고) 정적 라이브러리 프로젝트를 컴파일

-> QT 가 이전에 만든 라이브러리를 추가 프로젝트의 헤더 파일을 포함하여 GUI 프로젝트를 만들 .. 그리고가는 것이 좋다.