Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Link with specific library
Forum Updated to NodeBB v4.3 + New Features

Link with specific library

Scheduled Pinned Locked Moved Qt Creator and other tools
8 Posts 3 Posters 5.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cincirin
    wrote on last edited by
    #1

    I have posted on QtCentre forum a problem, but it seems that no one has answered this question, so I'll post here too, hoping that someone has an idea.
    I have my application linked with latest version of GDAL, which don't have the same libpng version as Qt. My application project looks like:

    QT -= core gui
    GDALDIR = LIBS/GDAL/gdal-1.8
    LIBS = -L$$GDALLIBDIR -lGDAL

    When I try to open png file, libnpg say that it's linked with a newer version. Indeed when I debugged my application, it use the libpng open file function from Qt/3dparty/png instead from my GDAL library. On windows platform works just fine.

    Can someone explain how to solve this problem ?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      Just make sure that both libraries use the same version of libpng. You will need to up-/downgrade one of the two libraries.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cincirin
        wrote on last edited by
        #3

        Thank for your answer.
        Ok, I'll try to do this. But my puzzlement remains the same. If my project have LIBS = -lGDAL, why QtCreator link my application with libpng from Qt/3dparty/png instead of libpng sources from GDAL, and this only happens in Ubuntu, but in windows work perfectly.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          I'd guess you'll have to recompile one the both.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cincirin
            wrote on last edited by
            #5

            I recompiled all the files in GDAL ( but forget about GDAL, I'm almost sure that the same thing will happen if I want to use libpng only, other version, older than Qt/3dparty/png ).
            Also I use QtSDK version 4.7.0, that comes with QtCreator 2.0.1, so libpng is already linked in libQtGui4.so.
            But note that my project has QT -= core gui, I do not use anything from QtGUI, but my app insists to link with libpng from libQtGui4(d).a

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cincirin
              wrote on last edited by
              #6

              Also may be the same problem with this ? : "(first note)":http://www.qtcentre.org/threads/39047-Linking-to-specific-PNG-JPEG-and-TIFF-libraries-when-building-Qt

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                If libpng is linked statically, it's a compiler issue. If it's linked dynamically, it's a problem of the library loader.

                Anyways, the differences seem to be incompatible, so in my opinion you will have to recompile one to use the libpng of the other.

                What do you mean with

                bq. but my app insists to link with libpng from libQtGui4(d).a

                If you don't link against QtGui, no symbols from that lib are imported in your app. Do you mean "libpng.a from the directory where libQtGui lives"? The latter can be avoided by using the full pathname to libpng.a.

                http://www.catb.org/~esr/faqs/smart-questions.html

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  cincirin
                  wrote on last edited by
                  #8

                  libpng is linked statically.
                  What I wanted to say is: if I call for example "png_create_read_struct" function which resides in libpng library, debug my application, step into "png_create_read_struct" function, I expect debugger to go in "pngpread.c" file from my libpng, but the debugger shows, is "pngread.c" from qt/src/3rdparty/libpng. From what I understand, by default, Qt supports png read/write linked in QtGui, so this is my puzzle.

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved