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. External prebuilt libraries
Forum Update on Monday, May 27th 2025

External prebuilt libraries

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 894 Views
  • 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.
  • V Offline
    V Offline
    vlada
    wrote on last edited by
    #1

    Hi,

    since I was solving some problems with external libraries, I realized I don't really understand how it works in QtCreator. There is a guide here and I'm following it.

    But it doesn't seem to be working as described there for me. According to the guide, I should put my .dll file to 3rdparty/my_lib/bin/mylib.dll. But this doesn't work. Everything works fine if I put the .dll to 3rdparty/my_lib/lib/mylib.dll

    It makes sense, because in the example the bin directory isn't mentioned anywhere in the project file:

    INCLUDEPATH += 3rdparty/CatWhisperer/include
    LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
    

    What am I missunderstanding here?

    VRoninV 1 Reply Last reply
    0
    • V vlada

      Hi,

      since I was solving some problems with external libraries, I realized I don't really understand how it works in QtCreator. There is a guide here and I'm following it.

      But it doesn't seem to be working as described there for me. According to the guide, I should put my .dll file to 3rdparty/my_lib/bin/mylib.dll. But this doesn't work. Everything works fine if I put the .dll to 3rdparty/my_lib/lib/mylib.dll

      It makes sense, because in the example the bin directory isn't mentioned anywhere in the project file:

      INCLUDEPATH += 3rdparty/CatWhisperer/include
      LIBS += -L"3rdparty/CatWhisperer/lib" -lCatWhisperer
      

      What am I missunderstanding here?

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @vlada said in External prebuilt libraries:

      But it doesn't seem to be working

      What's not working? the compilation or the program doesn't run?

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vlada
        wrote on last edited by
        #3

        @VRonin Sorry for not being more specific. Compilation works fine but the program immediately crashes after start because it won't find the shared library.

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by VRonin
          #4

          This has nothing to do with Qt. Windows has pre-determined locations where it looks for libraries: https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
          99% of the time option 1 is the way to go, 0.9999999% option it's option 6

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          2
          • V Offline
            V Offline
            vlada
            wrote on last edited by vlada
            #5

            @VRonin I don't think this is the case. Maybe I didn't describe it correctly. Let's say this is how my project looks like:

            c:\qtapp\myapp\main.cpp
            c:\qtapp\myapp\3rdparty\mylib\include\mylib.h
            c:\qtapp\myapp\3rdparty\mylib\lib\mylib.dll

            Now I compile the app and the .exe will be created in
            c:\qtapp\build-myapp-Desktop_Qt_5_13_1_MinGW_32_bit-Release\release\myapp.exe

            QtCreator probably adds the path of Qt libraries to the Windows search path, so these are found by the application and I assume it also adds the library path c:\qtapp\myapp\3rdparty\mylib\lib.

            This works fine. But according to the guide I linked in my first post, the .dll file should be located in c:\qtapp\myapp\3rdparty\mylib\bin. But this doesn't work. So is the guide wrong?

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              That guide is about compiling a program using a 3rd party library, not deploying it. So the guide is not wrong, it's just not covering this aspect. I suspect that windeployqt will probably recognise the /bin structure and deploy the 3rd party library correctly

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              V 1 Reply Last reply
              0
              • VRoninV VRonin

                That guide is about compiling a program using a 3rd party library, not deploying it. So the guide is not wrong, it's just not covering this aspect. I suspect that windeployqt will probably recognise the /bin structure and deploy the 3rd party library correctly

                V Offline
                V Offline
                vlada
                wrote on last edited by
                #7

                @vronin I'm not talking about deploying. I'm talking about developing my application and running it within QtCreator.

                VRoninV 1 Reply Last reply
                0
                • V vlada

                  @vronin I'm not talking about deploying. I'm talking about developing my application and running it within QtCreator.

                  VRoninV Offline
                  VRoninV Offline
                  VRonin
                  wrote on last edited by VRonin
                  #8

                  developing my application

                  The linker doesn't need the dll file so its location is irrelevant

                  running it within QtCreator

                  That's just an option inside Qt creator: https://doc.qt.io/qtcreator/creator-run-settings.html#selecting-the-run-environment

                  Just add the path to the bin directory to the PATH variable for the run environment

                  "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                  ~Napoleon Bonaparte

                  On a crusade to banish setIndexWidget() from the holy land of Qt

                  1 Reply Last reply
                  3

                  • Login

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