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. [SOLVED] Change default location of QtCore.dll and QtGui.dll
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Change default location of QtCore.dll and QtGui.dll

Scheduled Pinned Locked Moved Installation and Deployment
10 Posts 4 Posters 14.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.
  • D Offline
    D Offline
    d2uriel
    wrote on last edited by
    #1

    Dear Qt developers,

    This is probably going to be a very simple question but yet I cannot find an answer using Google nor the search option here on the forums.

    By default, if I want to run a Qt app I need to have both QtCore.dll and QtGui.dll in the same folder as my .exe file. Is there any way to move those files into let's say a /dll folder and tell my app to look for them inside? I'm guessing it's somewhat linker connected but as I stated - can't find an answer.

    Why do I want to do that? Because in my applications folder I want to have only my executable file and no other files present. It will look nice :-).

    Looking forward to an answer.

    Best regards,

    Daniel.

    "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Those files need to be in the path. In the same directory as the .exe works very well for that, as it is the first place windows looks so you never end up in version conflicts, but you can also define other places. However, you can AFAIK not do that from within your own program (as you can for plugins), as at that point your program already needs to have found the libraries.

      One option may be a startup script however: a script that basically sets the path to search for libraries to whatever you need it to be, and then starts your application executable itself.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        d2uriel
        wrote on last edited by
        #3

        Thank you for your answer Andre. Now I'm thinking about a different way of achieving that (I want to be as far as possible to batch files, I want the application to be as OS independent as possible). Please tell me if any of those ways are elegant ;-):

        1. Put my whole application into a library and move it along with Qt's libraries to a different folder. Then write a small program which will load up my library and transfer control to it.

        2. Have 2 separate executables. First one is going to be the main application itself put into the /dll folder and the second one will only start up the previous one and close itself down.

        "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          If you really want such a solution, I would prefer solution 2. I have sometimes seen such things.
          But solution 1 does not solve the problem, as you have to load the dll then by LoadLibrary which will implicitly try to load the Qt libs. But they are not inside the search path then...

          Regarding the platform independency:

          none of the solutions is works on all platforms.

          Windows loads dll as follows:

          Location of the executable

          current dir

          win32 directory

          search the PATH variable

          Linux uses another aproach

          search directories from env variable: LD_LIBRARY_PATH

          The list of libraries cached in /etc/ld.so.cache.

          /lib, followed by /usr/lib.

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • U Offline
            U Offline
            uranusjr
            wrote on last edited by
            #5

            I think the second one is definitely better. If you go for the first one, then you'll need to at least write another C/C++ application in order to load in the libraries. Using the second option, you need no more than a very simple batch script (in Windows) to launch another application.

            The problem here is that if you need to write another C/C++ application, you might one day need to worry about the libraries needed for that application.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              d2uriel
              wrote on last edited by
              #6

              On the other hand I could statically link to both Qt libs. This would increase the size of my executable but I would achieve the same thing, right?

              Thank you for the answers!

              "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                But for linking statically, you have restrictions from the licenses:

                You must use Qt Commercial license, or (AFAIK) make you app GPL.
                LGPL does not allow static linking...

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  d2uriel
                  wrote on last edited by
                  #8

                  The app is only for my master thesis. It's probably not going to be available anywhere ;-). If releasing it under GPL is an option for not breaking any licenses then I can do that without a problem.

                  "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on last edited by
                    #9

                    But I suggest you read the license stuff carefully, I'm not a layer :-)

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      d2uriel
                      wrote on last edited by
                      #10

                      Alright, will do that. Thank you for your help!

                      "Do not judge, and you will never be mistaken." - Jean-Jacques Rousseau

                      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