我正在尝试编译一个同时使用Qt框架和libpng的项目。我在以前版本的libpng中遇到错误,所以我下载了一个较新的代码库,现在当我尝试构建项目时出现以下错误:
Running build steps for project mytool-win-cli...
Configuration unchanged, skipping qmake step.
Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe"
C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/_src/mytool-win-cli-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug'
g++ -mthreads -Wl,-subsystem,windows -o debug\mytool-win-cli.exe debug/main.o -L"c:\QtSDK\Desktop\Qt\4.7.4\mingw\lib" -lmingw32 -lqtmaind -lpng -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libpng.a(libpng14_la-pngread.o): In function `png_create_read_struct_2':
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngread.c:90: undefined reference to `setjmp'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libpng.a(libpng14_la-pngerror.o): In function `png_default_warning':
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:361: undefined reference to `__getreent'
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:362: undefined reference to `__getreent'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libpng.a(libpng14_la-pngerror.o): In function `png_default_error':
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:297: undefined reference to `__getreent'
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:298: undefined reference to `__getreent'
/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:297: undefined reference to `__getreent'
c:/qtsdk/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libpng.a(libpng14_la-pngerror.o):/usr/src/packages/libpng/14/libpng-1.4.8-1/src/libpng-1.4.8/pngerror.c:298: more undefined references to `__getreent' follow
collect2: ld returned 1 exit status
mingw32-make[1]: Leaving directory `C:/_src/mytool-win-cli-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug'
mingw32-make[1]: *** [debug\mytool-win-cli.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
Error while building project mytool-win-cli (target: Desktop)
When executing build step 'Make'
我怀疑包含的libpng源和mingw编译的版本之间的版本存在问题,但我无法确切地说。我做错了什么?
答案 0 :(得分:2)
所以,真的没有理由这样做,Qt已经发布了qpng。 QImage将读取和写入它们。
答案 1 :(得分:0)
当你构建Qt时,QtGui是用libpng编译的,它是libQtGui.so中的静态链接
我认为你不应该再次链接libpng。
在src / gui /中你make和make install,libQtGui.so应该在你的lib中。