背景
安装Qt时默认的是使用动态库,因此并没有提供编译好的静态库下载。因此,我们需要下载/安装相应的Qt源码,自己动手生成静态库。
不然没法直接一个exe运行,还需要拷贝动态库、配置环境变量等。
编译Qt
Qt5.8 在windows下静态编译
https://blog.csdn.net/zhaoxd200808501/article/details/79368841
http://c.biancheng.net/view/3858.html
1.配置Qt(1分钟)
切换到Qt的源码目录
cd C:\Qt\Qt5.9.9\5.9\Src
运行命令
configure.bat -confirm-license -opensource -platform win32-g++ -release -static -static-runtime -opengl desktop -qt-sqlite -qt-pcre -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -nomake tests -nomake examples -no-compile-examples -prefix "E:\Qt\Qt5.9.9\5.9.9\mingw53_32_static"
2.编译(4小时左右)
mingw32-make -j2
3.安装(20分钟左右,硬盘好的话会快点)
mingw32-make install
参加资料
Qt5.8 在windows下静态编译
https://blog.csdn.net/zhaoxd200808501/article/details/79368841
怎样静态编译Qt程序
https://jingyan.baidu.com/article/363872ec3db7386e4aa16f53.html