How to create executable file for a Qt Application?

前端 未结 4 1338
温柔的废话
温柔的废话 2020-12-13 15:17

I\'ve been searching on the internet for some useful and clear information about this, it\'s annoying that such a trivial thing is so hard to do.

What I need is to c

相关标签:
4条回答
  • 2020-12-13 15:18

    Do these steps:

    1- Open qt command-line window.

    2- Go to the directory which .exe file exists (using cd command).

    3- Run "windeployqt.exe --quick ." command

    4- Run your exe file and enjoy it!

    This video is great

    0 讨论(0)
  • 2020-12-13 15:33

    So you downloaded Qt SDK and you want to link Qt libraries statically into you application, right?

    First of all, if you link statically, you don't need any Qt*.dll to be present anywhere because it is built into the application. So that alone means that your application is built using dynamic linking.

    From my experience, that safest way to get it all working is:

    Download Qt sources, build and install them with nmake ( using Visual Studio Command Prompt from Menu Start -> Application -> Visual Studio 2008 ). Just remember that the size of the statically linked application is dependent on the size of the *.libs and these are dependent on the pre-build configuration, for example, you can minimize the size of you application by turning off some features ( this is an example config for MacOSX, just watch out for the ones specific for Windows and add proper plaftorm - see configure.exe --help for details ):

    ./configure -arch x86 -platform macx-g++ --universal -cocoa -debug-and-release -opensource -static -fast -no-accessibility -no-sql-sqlite -no-qt3support -no-opengl -no-openvg -qt-zlib -no-gif -no-libmng -qt-libmng -no-libtiff -qt-libjpeg -no-3dnow -sse -no-sse2 -no-openssl -no-dbus -no-phonon -no-multimedia -no-audio-backend -webkit -no-script -no-scripttools -no-declarative -nomake demos -nomake examples -no-exceptions -no-accessibility -confirm-license
    

    Install, setup and use Visual Studio Add-In for you Qt project (here ).

    Good Luck! :)

    0 讨论(0)
  • 2020-12-13 15:34

    Basically you have to look for mingw subfolder deep into qt tree, where qt utilities reside, and copy needed dll's.

    These are the steps I follow, based upon QT 4.7.4, for packaging the application with correct shared libraries.

    1. Let's say you've installed QT under c:\qtsdk
    2. Open your project, and compile it in release mode.
    3. Go to this directory: C:\QtSDK\Desktop\Qt\4.7.4\mingw\bin -- it contains all shared libraries. Debug libraries end with a "d" -- frex, QtCore.dll is release version, while QtCoreD.dll is debug version
    4. Copy at least these files into your release directory (where your .exe lies)

      • mingwm10.dll
      • libgcc_s_dw2-1.dll
      • QtCore4.dll
      • QtGui4.dll

      I just built, tested and deployed a dummy project this way.

    0 讨论(0)
  • 2020-12-13 15:36

    Here is what I did and I got it to work after some time;after making sure that your program builds inside Qtcreator,go to the directory that contains your exe and double click on it.(I'm using windows and don't know if it is the same on other platforms).A window should popup telling you which .dll is missing.Go to the directory where Qt is installed and type the exact name in the search bar(top-right in Windows 7) and the dll should show up in search results.Right click and choose open file location.Copy the file where your exe is located .Double click on the exe again.If another .dll is missing repeat the same thing until none is missing.In the end your program should run. Hope this helps.

    0 讨论(0)
提交回复
热议问题