How to use the libpng in Qt Widgets Application?



  • I want to use libpng in iOS and mac.
    I know that Qt integration libpng,but I can‘t find it.⊙▽⊙
    Where is libpng's .h file in QtSDK?
    My QtSDK version is 5.5
    THX..



  • Qt doesn't expose those, as one is expected to use the Qt's own image
    classes. As for every other 3rdparty library, none of the headers are shipped
    and as far as I know most of if not all of the stuff is linked statically to the
    appropriate qt library by default.



  • @Huulivoide
    Thanks for your posts.
    I am using libpng source file that is download from libpng site in my project.
    But there are many redefine errors in iOS , like this:

    ===================
    duplicate symbol _png_set_sig_bytes in:
    /Users/goldlion/Documents/workspace/Qt/build-qt_opengles2-iphonesimulator_clang_Qt_5_5_0_for_iOS-Debug/qt_opengles2.build/Debug-iphonesimulator/qt_opengles2.build/Objects-normal/i386/png.o
    /Applications/Qt5.5.0/5.5/ios/lib/libQt5Gui_iphonesimulator_debug.a(png.o)
    duplicate symbol _png_sig_cmp in:
    /Users/goldlion/Documents/workspace/Qt/build-qt_opengles2-iphonesimulator_clang_Qt_5_5_0_for_iOS-Debug/qt_opengles2.build/Debug-iphonesimulator/qt_opengles2.build/Objects-normal/i386/png.o
    /Applications/Qt5.5.0/5.5/ios/lib/libQt5Gui_iphonesimulator_debug.a(png.o)
    duplicate symbol _png_zalloc in:
    /Users/goldlion/Documents/workspace/Qt/build-qt_opengles2-iphonesimulator_clang_Qt_5_5_0_for_iOS-Debug/qt_opengles2.build/Debug-iphonesimulator/qt_opengles2.build/Objects-normal/i386/png.o
    /Applications/Qt5.5.0/5.5/ios/lib/libQt5Gui_iphonesimulator_debug.a(png.o)
    duplicate symbol _png_zfree in:
    ...

    And it works good in mac.⊙▽⊙
    But they are one same project.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The only place you'll find libpng with Qt is in the sources. It fails on iOS because iOS is a static build so it already contains all the symbols of the jpeg library it uses.



  • @SGaist
    THX,it's work good.
    I think this way is best way.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.