How to add png++/libpng to Qt Creator?



  • I will change the code to use QImage but first I need to run it as is (with png++)

    If this can't be done on Qt Creator any other free compiler with Qt support would be good, thanks.

    Using windows Qt Creator 2.4.1

    I already tried different version of libng and png++

    I added this to my .pro file so it loads libraries
    @LIBS += -L"$$PWD/lpng159/" -lpsapi
    LIBS += -L"$$PWD/png++/" -lpsapi@

    but when compiling I get errors like these:
    @build-desktop-Qt_4_8_0_for_Desktop_-MinGW__Qt_SDK__Debug/../xx/png++/info_base.hpp:55: undefined reference to png_create_info_struct' debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:60: undefined reference topng_read_info'
    debug/main.o:build-desktop-Qt_4_8_0_for_Desktop
    -MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:69: undefined reference to png_get_IHDR' debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:71: undefined reference topng_get_valid'
    debug/main.o:build-desktop-Qt_4_8_0_for_Desktop
    -MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:75: undefined reference to png_get_PLTE' debug/main.o:build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:79: undefined reference topng_get_valid'
    debug/main.o:build-desktop-Qt_4_8_0_for_Desktop
    -_MinGW__Qt_SDK__Debug/../xx/png++/info.hpp:85: undefined reference to `png_get_tRNS'@


  • Moderators

    welcome to devnet

    Are you sure that there is info_base.hpp and info.hpp in the directory png++ ?



  • Thank you :)
    yes the file are there I extracted png++ again to test, still same problem.


  • Moderators

    Do you have "includepath":http://developer.qt.nokia.com/doc/qt-4.8/qmake-variable-reference.html#includepath set?

    But probably there is a problem with your relative path you are using. Is there a directory "xx" parallel to "build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug"?



  • Ye, sorry I just hate to show real paths online, specially when they are absolute.

    My project path is Qt\untitled, the "debug" path is located on Qt\untitled-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug

    I didn't change anything on default project, just added the 2 lines mentioned above to my project file.

    Here is roughly my folder structure
    @Qt
    untitled-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug\ <-auto generated
    <auto generated files>
    untitled
    untitled.pro
    lpng159
    <extracted libpng files(png.c, png.h, etc)>
    png++
    <extracted png++ files(png.hpp, info.hpp, info_base.hpp, etc)>@



  • Anyone? I don't want to cancel the use of Qt just because their IDE can't import a simple library


  • Moderators

    [quote author="kwyjibo" date="1331163269"]Anyone? I don't want to cancel the use of Qt just because their IDE can't import a simple library[/quote]

    That's a pretty bold statement. I wouldn't chalk up the fact that you're having problems as "their IDE can't import a simple library." Thousands of developers write millions of lines of code every day using the IDE, and I haven't heard of library importing being a huge stumbling block. Typically it works very well.

    On a more helpful track, though, do you know for sure if the $$PWD refers to your untitled/ directory at build-time? or if it refers to untitled-build-desktop-* ? (I don't remember the semantics of it offhand.) You might try turning off shadow build in your project preferences, to see if that makes a difference.


Log in to reply
 

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