2016-06-09 114 views
0

上週我一直試圖將GDAL庫鏈接到qt-creator,但是爲了正確鏈接它,一直在編譯庫時遇到問題。 我收到此錯誤在Windows上使用MinGW編譯GDAL/OGR

libtool: link: g++ .libs/gdalinfo_bin.o -o .libs/gdalinfo.exe -L/local64/lib /c/gdal-2.1.0/.libs/libgdal.a -lodbc32 -lodbccp32 -lz -lpthread -lws2_32 
C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.9.2/../../../../x86_64-w64-mingw32/lib/../lib/libiconv.a(localcharset.o):localcharset.c:(.text+0x8): undefined reference to `__imp_GetACP' 
collect2.exe: error: ld returned 1 exit status 
make[1]: *** [gdalinfo.exe] Error 1 
make[1]: Leaving directory `/c/gdal-2.1.0/apps' 
make: *** [apps-target] Error 2 

具有與該編譯器這麼多問題之後,我不能確定這是否是設置或我是否需要重新配置的GDAL庫的東西爲Windows/MinGW的消費問題。

任何人都可以幫助我嗎?

編輯:這可能導致該問題,但我不能確定如何解決它

*** Warning: linker path does not have real file for library -lz. 
*** I have the capability to make that library automatically link in when 
*** you link to this library. But I can only do this if you have a 
*** shared version of the library, which you do not appear to have 
*** because I did check the linker path looking for a file starting 
*** with libz and none of the candidates passed a file format test 
*** using a file magic. Last file checked: C:/MinGW/mingw64/x86_64-w64-mingw32/lib/libz.a 
*** The inter-library dependencies that have been dropped here will be 
*** automatically added whenever a program is linked with this library 
*** or is declared to -dlopen it. 

*** Since this library must not contain undefined symbols, 
*** because either the platform does not support them or 
*** it was explicitly requested with -no-undefined, 
*** libtool will only create a static version of it. 

以前的嘗試使我相信,我需要它不是由GDAL指令指定的MinGW-64版本,所以我用this教程修改了MinGW的64位庫

+0

您可以嘗試將Kernel32.lib鏈接到應用程序嗎?在那裏定義了:: GetText(..)正在使用的缺失符號。 – KimKulling

+0

我不確定你的意思。我目前正在從源代碼編譯庫,所以目前還沒有涉及到的應用程序 –

+0

好的,但不知何故Kernel.lib中的符號不​​見了。我的建議是:嘗試鏈接並檢查是否修復了未解決的符號。 – KimKulling

回答

0

有同樣的問題。

  • 編譯ZLib
  • 將在MinGW/binzlib1.dll
  • libz.alibz.dll.aMinGW/lib:通過解決它。
0

我強烈建議將您的開發工具集使用MSYS2及其包管理器。它包括大量的預編譯庫,如GDAL,所以你不必花時間去試圖讓它們編譯。

相關問題