How to include QtGui4.dll into app



  • Well, when I build 1 project, It will publish a folder desktop. Follow some instructions on internet. I copied file QtGui4.dll from path E:\Programs\QtSDK\QtCreator\bin to path C:\Windows\System32. It's pity, It didn't run.

    !http://nn8.upanh.com/b6.s29.d3/796464d0d5d4298bec675fcd85db715c_45757728.h1.png(Image)!

    Seems app can't "see" file QtGui4.dll...

    ps: when I send app to client, I can't write guide document and require them must do anything (of course they can't know what PATH is). Having another way to solve ...



  • The dlls you copied is wrong.

    You should copy the dlls which are provided by the Qt Library instead of Qt Creator.


    BTY, you never need to copy the dll to system directory, add the QTDIR/bin to your system environment variable will works.

    If you are deploy your application, don't forget the plugins needed by your application.



  • Be also aware that you are obviously publishing a debug version of your application (QtGui d 4.dll), not a release version (which requires QtGui4.dll).

    When running your application on the development machine and outside of QtCreator it is sufficient to add $QTDIR/bin to your path (where $QTDIR points to your Qt installation); when released, you will have to distribute the DLLs along with your application and place it in one of the following locations:

    • The directory where the executable module for the current process is located
    • The current directory
    • The Windows system directory. The GetSystemDirectory function retrieves the path of this directory (usuall C:\Windows\System32)
    • The Windows directory. The GetWindowsDirectory function retrieves the path of this directory (usually C:\Windows)
    • The directories listed in the PATH environment variable

    See also "Deploying an Application on Windows":http://qt-project.org/doc/qt-4.8/deployment-windows.html.



  • Thanks, I still have a little problem. I add following url into environment variable.

    !http://nn4.upanh.com/b2.s26.d2/ece9b9f20f1ecd13fdd9cd9e8683e104_45768014.h1.png!

    Run app again, it display above error. Lukas's right, first I need run a debug version. Really I can't see QtGui d 4.dll in url which I added into environment variable (only QtGui4.dll)

    @Lukas: You wrote "one of the following locations" or "all of the following locations", having difference? which way did you choose to distribute release version?



  • You either build a debug version of your application or you build a release version of your application (you can switch between them in the lower left corner in QtCreator, right above the 'Run' button). A debug version of your application is used during development, as it contains additional code and information which allow for better error tracking. When deploying an application, you should always use a release version, as this additional information is of no use to the user, slows down and enlarges your applcation and possibly exposes internal implementation details.

    A debug version of your application needs a debug version of the Qt libraries (having a d in their name, for example QtGuid4.dll) and a release version of your application needs a release version of the Qt libraries (having no d in their name, for example QtGui4.dll).

    In addition of beeing tied to the application version, libraries are also tied to toolchain used to build the application. If you build your application using MSVC2008, you will have to use libraries beeing built with MSVC20008 as well, if you build your application using MSVC2010, you will have to use libraries beeing built MSVC2010, and so on.

    These libraries can be found in the corresponding Qt installation directory, which is usually <where you have installed the SDK>/Desktop/<version>/<toolchain>.

    So if you build a debug version of your application using MSVC2010 and Qt 4.8.2 you will have to pick the *d4.dll libraries from E:\Programs\QtSDK\Desktop\4.8.2\MSVC2010 (or similiar, I have no Qt SDK installation at hand) and place it in one of the locations I've posted - usually the directory containing the .exe file.

    Make sure you've read the article I've linked.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.