Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 create an executable file for my Qt project, in order to run it in other computers. My project runs nicely in the Qt Creator, but when I try to run the executable created in the release folder I get errors about some dll missing, and though I have put all of them in the same directory of my .exe I now got some errors about entrypoints in procedures inside the dll (QtCore4.dll).

The solution looks like to be a static linking, I've found many information about it, but none of them really helped me. Here is what I have tried so far:

  • Using the executable created in the release folder as I said above.
  • Static Linking, following this tutorial (and many others, all almost the same thing): http://doc.qt.io/qt-4.8/deployment-windows.html but I get the following error during the "configure -static": NMAKE : fatal error U1077: '"c:Arquivos de programasMicrosoft Visual Studio 9. 0VCBINcl.EXE"' : return code '0x2' Stop. Building qmake failed, return code 2

For that I couldn't find any solution, so here I am, just trying to create an executable file for my Qt project, hope you guys can give me some light here.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
640 views
Welcome To Ask or Share your Answers For Others

1 Answer

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:QtSDKDesktopQt4.7.4mingwin -- 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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...