Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. How to make my Qt application load dlls in a different folder?
Forum Updated to NodeBB v4.3 + New Features

How to make my Qt application load dlls in a different folder?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
13 Posts 2 Posters 1.8k 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.
  • jsulmJ jsulm

    @Roberrt On Windows you need to add the folder containing your libraries to environment variable PATH before starting your app.

    R Offline
    R Offline
    Roberrt
    wrote on last edited by Roberrt
    #3

    @jsulm

    I have put all dependencies in the folder D:\New folder and added it under the user Environment Variables, is it correctly?

    I tested it, but it still complains about missing DLLs.

    jsulmJ 1 Reply Last reply
    0
    • R Roberrt

      @jsulm

      I have put all dependencies in the folder D:\New folder and added it under the user Environment Variables, is it correctly?

      I tested it, but it still complains about missing DLLs.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Roberrt I was talking about PATH variable. I can't see it in your screen shot. And keep in mind: if you do it this way you will need to log off and on again.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Roberrt I was talking about PATH variable. I can't see it in your screen shot. And keep in mind: if you do it this way you will need to log off and on again.

        R Offline
        R Offline
        Roberrt
        wrote on last edited by Roberrt
        #5

        @jsulm said in How to make my Qt application load dlls in a different folder?:

        PATH variable

        To clarify, are you referring to System Variables > Path variables?

        I've added the folder and rebooted, but now I'm getting this error:

        This application failed to start because no Qt platform plugin could be initialized.
        

        This is my dependencies folder:

        90824fec-ec3a-4387-bb5b-59418764c19d-image.png

        jsulmJ 1 Reply Last reply
        0
        • R Roberrt

          @jsulm said in How to make my Qt application load dlls in a different folder?:

          PATH variable

          To clarify, are you referring to System Variables > Path variables?

          I've added the folder and rebooted, but now I'm getting this error:

          This application failed to start because no Qt platform plugin could be initialized.
          

          This is my dependencies folder:

          90824fec-ec3a-4387-bb5b-59418764c19d-image.png

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #6

          @Roberrt said in How to make my Qt application load dlls in a different folder?:

          are you referring to System Variables > Path variables?

          I'm referring to PATH environment variable.
          You can set it in System Variables > Path variables. But as I already pointed out above: you need to log off and log in again after changing PATH. If it then still does not work then open a terminal and enter command "set" - check the value of the PATH variable there.
          You should also consider that using paths with spaces can easily cause problems.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          R 1 Reply Last reply
          0
          • jsulmJ jsulm

            @Roberrt said in How to make my Qt application load dlls in a different folder?:

            are you referring to System Variables > Path variables?

            I'm referring to PATH environment variable.
            You can set it in System Variables > Path variables. But as I already pointed out above: you need to log off and log in again after changing PATH. If it then still does not work then open a terminal and enter command "set" - check the value of the PATH variable there.
            You should also consider that using paths with spaces can easily cause problems.

            R Offline
            R Offline
            Roberrt
            wrote on last edited by
            #7

            @jsulm said in How to make my Qt application load dlls in a different folder?:

            You should also consider that using paths with spaces can easily cause problems.

            I modified it to a path without spaces, and rebooted, continue getting the same error message.

            If i execute the exe inside of the DLL folder it works correctly.

            I think the problem is these folders dont?

            I used windeployqt to copy the dependencies, is it possible to 'copy' everything without creating any folder?

            jsulmJ 1 Reply Last reply
            0
            • R Roberrt

              @jsulm said in How to make my Qt application load dlls in a different folder?:

              You should also consider that using paths with spaces can easily cause problems.

              I modified it to a path without spaces, and rebooted, continue getting the same error message.

              If i execute the exe inside of the DLL folder it works correctly.

              I think the problem is these folders dont?

              I used windeployqt to copy the dependencies, is it possible to 'copy' everything without creating any folder?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @Roberrt What about my suggestion from above: "If it then still does not work then open a terminal and enter command "set" - check the value of the PATH variable there.". If the PATH is set correctly try to start your app from a terminal - does that work?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • R Offline
                R Offline
                Roberrt
                wrote on last edited by
                #9

                @jsulm yes, when i enter "set" in the terminal i can see the path.

                I tried launching the app using the terminal it gave the same error.

                jsulmJ 1 Reply Last reply
                0
                • R Roberrt

                  @jsulm yes, when i enter "set" in the terminal i can see the path.

                  I tried launching the app using the terminal it gave the same error.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  @Roberrt Can you show your PATH?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  R 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Roberrt Can you show your PATH?

                    R Offline
                    R Offline
                    Roberrt
                    wrote on last edited by Roberrt
                    #11

                    @jsulm

                    20f7b666-e9e4-459f-837f-c4cfdd4b2ce6-image.png

                    jsulmJ 1 Reply Last reply
                    0
                    • R Roberrt

                      @jsulm

                      20f7b666-e9e4-459f-837f-c4cfdd4b2ce6-image.png

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @Roberrt If c:\Users\Public\Qt is the folder with your libs it should work.
                      You also tried to use qt.conf: did you specify the folder with the libs using "Libraries = PAT_TO_LIBS_FOLDER"? Prefix is the app folder.

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      R 1 Reply Last reply
                      1
                      • jsulmJ jsulm

                        @Roberrt If c:\Users\Public\Qt is the folder with your libs it should work.
                        You also tried to use qt.conf: did you specify the folder with the libs using "Libraries = PAT_TO_LIBS_FOLDER"? Prefix is the app folder.

                        R Offline
                        R Offline
                        Roberrt
                        wrote on last edited by Roberrt
                        #13

                        @jsulm
                        I got it working for a new project containing just a push button, I also needed to create a variable with the name QT_PLUGIN_PATH under the System variables environment, and set the folder which contains these plugins folders (platforms, etc), in my case C:\Users\Public\Qt.

                        But for my app using qwebengine its not working, when i run the exe i don't see any error message neither my gui, then it closes :(

                        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