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. [Solved] Linking dynamic library
Forum Updated to NodeBB v4.3 + New Features

[Solved] Linking dynamic library

Scheduled Pinned Locked Moved General and Desktop
11 Posts 3 Posters 3.6k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    You can't link to dlls, you need the corresponding lib files

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • I Offline
      I Offline
      igorland
      wrote on last edited by
      #3

      SGaist. Can you clarify please?
      I need to link dynamically to the libQtGuid library. Do you mean I need to copy libQtGuid.a to the folder with the exe file? Does it work for both Windows and Mac? What do I need to write in the pro file?

      [code]
      DEPENDPATH += /
      INCLUDEPATH += /
      LIBS+= -L .. -libQtGuid
      [/code]

      Is this correct?
      Many thanks!

      1 Reply Last reply
      0
      • I Offline
        I Offline
        igorland
        wrote on last edited by
        #4

        I also found this in one of the threads here:
        "if library ships only dlls(rarely): manually load at runtime with LoadLibrary/GetProcAddress (or the QLibrary class equivalent) and use. Nothing is needed at compile*/link* time, .dll is needed at runtime."

        So, can I still have the .dll files stored in the exe directort and use the LoadLibrary?

        Thank you!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          If you setup your project correctly (pro files) the Qt libraries will be automatically linked for you, it this is not the case, you have something wrong in your project file

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • I Offline
            I Offline
            igorland
            wrote on last edited by
            #6

            SGaist. Sorry if my message was confusing. I need to distribute the compiled project created as an exe file. So I built it and copied it to the other computer. The exe file alone cannot work without the libraries that I need to link dynamically (due to LGPL). In the folder where the exe file is, I also copied the following libraries: icudt51.dll, icuin51.dll, icuuc51.dll, libwinpthread-1.dll, Qt5Cored.dll, Qt5Guid.dll, Qt5Networked.dll, and QttWidgetsd.dll.
            How do I link dynamically to these libraries so that it works on different computers when the libraries are saved in exactly same folder with the exe file?
            Thank you for your help and patience!

            1 Reply Last reply
            0
            • M Offline
              M Offline
              msue
              wrote on last edited by
              #7

              You'll have to distribute the release versions of the Qt-dlls without the "d" before the point. You will further have to distribute the msvccpxxx.dll and msvcrxxx.dll if you use MS VS. You can check which Dlls to ship with the program "depends.exe".
              On Windows, if the program runs on the development machine it will usually also run on another machine with the correct Dlls in the same directory as the executable. On Mac/Unix/Linux, this is something completely different.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                For deployment information there's "the Windows deployment guide":http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html don't overlook the platform plugin part

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  igorland
                  wrote on last edited by
                  #9

                  Oh, thank you so much! I had read that guide before and I tried to do everything as it said and it never worked.

                  I was missing this file: libstdc++-6.dll.

                  Thanks again for your great help!

                  1 Reply Last reply
                  0
                  • I Offline
                    I Offline
                    igorland
                    wrote on last edited by
                    #10

                    Sorry, I thought it was solved. Indeed, it worked on the computer with Qt installed. I sent it to a friend of mine, and it is not working on his computer. Two errors:

                    1. This application failed to start because it could not find or load the Qt platform plugin "windows". Reinstall the application may fix this problem.

                    2. Microsoft Visual C++ Runtime Library. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

                    "The application support team" is at a loss. I thought I have included all libraries needed. Can someone help please?

                    1 Reply Last reply
                    0
                    • I Offline
                      I Offline
                      igorland
                      wrote on last edited by
                      #11

                      Sorry. qwindows.dll was in the root directory and not in platform/. Back to solved again! Special thanks to SGaist!

                      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