Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Using a set of libraries

Using a set of libraries

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 3.0k 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.
  • E Offline
    E Offline
    Eonz
    wrote on last edited by
    #1

    This may not be the most relevant place to ask it, but I want to load a certain file format into memory in Qt on Windows.

    So the creators of the file format give you this zip file (which they claim is really "compile for vs2005") with multiple folders:

    bin <- contains some .exe and .dll files
    examples
    include <- contains a bunch of .h files
    lib <- contains a bunch of .lib files with

    In the lib folder there are multiple files, typically 4 versions of each, for example:

    something.lib
    something_d.lib
    something_dll.lib
    something_dll_d.lib

    I assume that the _d means debug, but I don't understand why there are then still two flavors of that. I'm sure that for someone who does this kinda thing a lot it would make sense.

    I don't care whether I link statically or dynamically I just want the stuff to link successfully. I include the folder with all the .h files in my .pro file like this:

    @INCLUDEPATH += ../../OpenEXR/include
    DEPENDPATH += ../../OpenEXR/include@

    And add a library like this:

    @LIBS += -L../../OpenEXR/lib/ -lsomething@

    Now, is there anything else that I would need to do to get it working? I constantly get the compiler/linker error "undefined reference to..." for stuff that are defined in the .h files but it looks to me like the linker isn't finding the real stuff. Do I need to somehow reference the folder with the .dll files?

    Please, if someone helps me, could you always refer to files by extension (.lib or .dll); generic use of words like "library" is a big source of my confusion.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      There are two types of libraries, static and shared. In addition, for shared libraries there exist import libraries, which are used by the linker at compile time to resolve symbols within the shared library.

      So I guess something.lib and something_d.lib are static libraries, release and debug. something_dll.lib and something_dll_d.lib are the import libraries, release and debug. There are most probably something.dll and something_d.dll somewhere too.

      If you want to link the libraries statically you will have to use something.lib. If you want to link the libraries dynamically you will have to use something_dll.lib AND use the __declspec(dllimport) directive for every symbol imported from the shared library (as symbol name are mangled differently in static and shared libraries).

      Apart from that your project file looks good (assuming the pathes are correct).

      EDIT I just googled your library and you should take a look "here":http://hebbut.net/Public.Offerings/OpenEXR.html, especially the Known Issues section.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        Eonz
        wrote on last edited by
        #3

        Thanks a lot Lukas for going so far with helping me. The "how" does make sense to me more. Not sure I understand "why" though :)

        As for getting it working I've pretty much given up.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Have you read the article I linked? Your problem can possibly solved by just adding
          @
          DEFINES += OPENEXR_DLL
          @
          to your project file.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Eonz
            wrote on last edited by
            #5

            Thanks again, after reading the link you posted I did exactly that, then cleaned, qmade and rebuilt, but it didn't solve the problem.

            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