2016-06-09 115 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,所以你不必花时间去试图让它们编译。

相关问题