Link to libpng in Qt

I am trying to compile a project that uses both the Qt framework and libpng. I had errors with the previous version of libpng, so I downloaded a new code base and now I get the following errors when trying to create my project:

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' 

I suspect that there is a version issue between the included libpng sources and the compiled mingw, but I cannot say. What am I doing wrong?

+4
source share
2 answers

So, there really is no reason for this, Qt already comes with qpng. QImage will read and write them.

+2
source

When you create Qt, QtGui compiles with libpng, this is a static link in libQtGui.so

You do not need to bind libpng again, I think.

in src / gui / you do and do the installation, libQtGui.so should be in your lib.

0
source

Source: https://habr.com/ru/post/1393105/


All Articles