Results 1 to 5 of 5

Thread: New to QT, How do I remove dependencies to QT .dll files?

  1. #1
    Join Date
    Mar 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default New to QT, How do I remove dependencies to QT .dll files?

    Hello qt community!

    I've been programming for a while in C++, and I finally discovered this awesome thing called QT. It's very beautiful, easy, and fun to use. I've been programming in Visual Studio ever since I began, but for many reasons I wanted to remove .NET from my gui applications, so I downloaded the QT creator.

    I have one small issue, when I try to run built .exe files from QT, I get a bunch of errors saying that .dll files such as "Qt5Widgets.dll" being required in the same folder to run the application. I'm assuming these files are from some sort of SDK? However, I do not want to jam all of those files into the same folder as the .exe I am creating, is there any way to statically link those into the build so I can just run the .exe by itself? I've done some google searching, but again I am new to QT so I don't fully understand the whole linking process yet. If anyone could give me an in-depth answer on how I can achieve this, I will be forever grateful.

    Thanks!
    Last edited by Fazor; 29th March 2014 at 12:20.

  2. #2
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: New to QT, How do I remove dependencies to QT .dll files?

    Here is the best explanation for deploying applications-> https://qt-project.org/doc/qt-5.0/qtdoc/deployment.html
    The .dll files are libraries which can be found in Qt's installation folder.

    Static linking is where you merge all your needed libraries inside the executable file making it bigger in size.
    Shared libraries is where you deploy the needed libraries with your executable file.

    Both have ups and downs which are explained in the link above, the main issue with static linking is that the executable file will be bigger, depending on your application, but you won't have issues of library files wouldn't be compatible if you release a newer version for the application.

    With shared libraries you get a smaller executable and on "update" you will deploy only the executable and newer/modified files,but if a newer version was made using different Qt version then the original application you would need also to redeploy the libraries,depending on the difference between Qt versions used. This is also explained in the link above if you look into the links in the deployment page.

    I suggest you do some documentation on deployment to see which is more suitable for you and look in both cases static and deploying with shared libraries.

  3. #3
    Join Date
    Mar 2014
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: New to QT, How do I remove dependencies to QT .dll files?

    Quote Originally Posted by adutzu89 View Post
    Here is the best explanation for deploying applications-> https://qt-project.org/doc/qt-5.0/qtdoc/deployment.html
    The .dll files are libraries which can be found in Qt's installation folder.

    Static linking is where you merge all your needed libraries inside the executable file making it bigger in size.
    Shared libraries is where you deploy the needed libraries with your executable file.

    Both have ups and downs which are explained in the link above, the main issue with static linking is that the executable file will be bigger, depending on your application, but you won't have issues of library files wouldn't be compatible if you release a newer version for the application.

    With shared libraries you get a smaller executable and on "update" you will deploy only the executable and newer/modified files,but if a newer version was made using different Qt version then the original application you would need also to redeploy the libraries,depending on the difference between Qt versions used. This is also explained in the link above if you look into the links in the deployment page.

    I suggest you do some documentation on deployment to see which is more suitable for you and look in both cases static and deploying with shared libraries.

    Static linking says "i.e a new version of the application" that's literally what an update on a single .exe is when there's no external dependencies.

    Also, this doesn't really explain how to achieve this. It only explains what it does.. I already know what it does, I just don't know how to statically link the libraries in qt creator.

  4. #4
    Join Date
    Oct 2013
    Posts
    142
    Thanks
    36
    Thanked 3 Times in 3 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: New to QT, How do I remove dependencies to QT .dll files?

    Qt static linking and deployment-question on stackoverflow
    There are answers on that question which might help you get started.

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,594
    Thanks
    13
    Thanked 1,587 Times in 1,516 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: New to QT, How do I remove dependencies to QT .dll files?

    The DLLs "from some SDK" are the Qt libraries. Deploying these is no different to asking the end user to install yet another version of the .Net runtime in order for your latest Microsoft creation to run. The only difference being the user might already have a suitable .Net runtime install by default or from another application.

    If you hold a commercial licence or are releasing your source under the GPL then you might find static linking useful. It comes with a range of limitations regarding dynamically loaded plugins that you may need to be aware of. Regardless of Qt licence some elements of Qt are only available under the LGPL, which imposes some other restrictions.
    You start by building your own Qt libraries from source for static linking as described in broad terms in the deployment information linked above and the Windows-specific page.

Similar Threads

  1. A tool to remove unused header files?
    By agarny in forum Qt Tools
    Replies: 5
    Last Post: 13th July 2012, 13:26
  2. Qt Creator "Remove file..." deletes files no matter what you do
    By Markus in forum Qt Tools
    Replies: 2
    Last Post: 6th December 2011, 19:52
  3. Build without any dependencies
    By Dato0011 in forum Qt Tools
    Replies: 5
    Last Post: 22nd December 2009, 15:21
  4. what are .gcda files and how to remove .gcda skips
    By learning_qt in forum Qt Programming
    Replies: 0
    Last Post: 9th November 2009, 10:44
  5. library dependencies.....
    By surender99 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 19:06

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.