PDA

View Full Version : How to build Qt statically on Windows?



N3wb
8th October 2012, 03:11
I'm a Qt newbie and cannot for the life of me figure out how to deploy my simple application. From the reading I've done, it seems that after building Qt statically I can simply add the following line to my .pro file:


CONFIG += static

However, I cannot get Qt to build statically. Here are the pages I've been reading and trying to follow:

http://doc.qt.digia.com/4.7-snapshot/deployment.html
http://doc.qt.digia.com/4.7-snapshot/deployment-windows.html
http://qt-project.org/wiki/Build_Standalone_Qt_Application_for_Windows
http://www.anavi.org/article/140/
http://qt-project.org/forums/viewthread/13032

...in addition to many threads on this forum.

Maybe I'm just stupid, but I cannot figure this out.

Can anyone help me?

ChrisW67
8th October 2012, 06:44
Open your Qt SDK command prompt. Your compiler environment needs to be correctly set up for the configuration to detect.
Change directory to the top of a Qt sources tree. The folder will contain files like configure.exe, INSTALL, README and folders like src/, qmake/ etc.
Execute:


configure -static -release -no-exceptions // + whatever options you need especially for plugins

Answer the licence questions then watch as the build is configured. Have coffee, a power nap...
Once configured, execute:


mingw32-make sub-src
// for MingW or, for Microsoft compilers,
nmake sub-src

Make a meal, read a good book, volunteer at your local welfare organisation...

Straight from Deploying an Application on Windows