Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved External prebuilt libraries

    General and Desktop
    2
    8
    254
    Loading More Posts
    • 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
      vlada last edited by

      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?

      V 1 Reply Last reply Reply Quote 0
      • V
        VRonin @vlada last edited by

        @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 Reply Quote 0
        • V
          vlada last edited by

          @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 Reply Quote 0
          • V
            VRonin last edited by VRonin

            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 Reply Quote 2
            • V
              vlada last edited by vlada

              @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 Reply Quote 0
              • V
                VRonin last edited by

                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 Reply Quote 0
                • V
                  vlada @VRonin last edited by

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

                  V 1 Reply Last reply Reply Quote 0
                  • V
                    VRonin @vlada last edited by VRonin

                    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 Reply Quote 3
                    • First post
                      Last post