Current location - Health Preservation Learning Network - Slimming men and women - How to set Qt Creator to realize static compilation?
How to set Qt Creator to realize static compilation?
Qt is compiled dynamically by default, but sometimes it is tedious to publish your program with many dynamic library files. At this point, you need to compile your program statically. In order to achieve static compilation, Qt must also compile library files statically. You can compile a static library with the following command:

1. put qmake _ lflags =-enable-stdcall-fix-wl, -enable-auto-import-wl, -enable-runtime in c: \ Qt \ 2010.05 \ Qt \ mkspecs \ win32-g++.

replace

QMAKE _ l flags =-static-enable-stdcall-fixup-Wl,-enable-

Automatically import -Wl, -enable-runtime-pseudo-reloc.

2. Find the Qt command prompt in the start menu and run it. Enter the command: configure-static-debug-and-release-no-exceptions-l "c: \ Qt \ 2010.05 \ Qt \ include"-l "c: \ Qt \ 2065438+.

-L specifies the path to prevent vc header files from being used.

Choose open source: o; Select license: y;

3. After the last command runs successfully, enter the command: mingw32-make sub-src.

It may be finished in 1 ~3 hours, and it will be ok when it is finished. . .