win10sp1升到最新版本
QT静态编译环境设置
(1)准备
1.迅雷:python-3.5.1 -》安装到C:\Python35,安装时勾选添加到路径
https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe
2.迅雷:ActivePerl-5.22.1.2201 -》安装到C:\Perl64
Download & Install Perl - ActiveState
3.优快云:openssl-1.0.1c_static_w32_mingw.rar-》解压到C:\Qt\openssl-1.0.1c_static_w32_mingw
openssl-1.0.1c_static_w32_mingw.rar
链接:https://pan.quark.cn/s/486ef32ff6c6 提取码:j8wJ
4.优快云:rubyinstaller-2.7.0-1-x64-》安装到C:\Ruby27-x64
rubyinstaller-2.7.0-1-x64
链接:https://pan.quark.cn/s/486ef32ff6c6 提取码:j8wJ
5.迅雷:Qt5.9.6 qt-opensource-windows-x86-5.9.6.exe-》安装到C:\Qt\Qt5.9.6
http://download.qt.io/archive/qt/5.9/5.9.6/qt-opensource-windows-x86-5.9.6.exe
6.迅雷:Qt5.9.6 qt-everywhere-opensource-src-5.9.6.zip-》解压到D:\qt-everywhere-opensource-src-5.9.6
http://download.qt.io/archive/qt/5.9/5.9.6/single/qt-everywhere-opensource-src-5.9.6.zip
(2)启动cmd
(3)检查
(4)配置相关
configure.bat -static -release -platform win32-g++ -prefix "C:\Qt\Qt5.9.6_MinGW_static" -qt-sqlite -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -openssl-linked -opensource -confirm-license -make libs OPENSSL_LIBS="-llibssl -llibcrypto -lgdi32" -L C:\Qt\openssl-1.0.1c_static_w32_mingw -I C:\Qt\openssl-1.0.1c_static_w32_mingw\include -nomake tools -nomake examples -nomake tests -skip qt3d -skip qtcanvas3d -skip qtcanvas3d -skip qtdatavis3d -skip qtlocation -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtwinextras
等大概10分钟
(5)make
mingw32-make
等大概3小时
(6)make install
mingw32-make install
等大概20分钟
(7)修改qmake.conf
(8)拷贝一些文件
1.复制动态库中 C:\Qt\Qt5.9.6\5.9.6\mingw53_32\bin\qmlscene.exe
到静态库 C:\Qt\Qt5.9.6_MinGW_static\bin文件夹中。
如果不拷贝则在Qt Creator中添加Qt库时会报qmlscene未安装的错误。
2.复制动态库中 C:\Qt\Qt5.9.6\5.9.6\mingw53_32\bin\Qt5Core.dll到静态链接 版的C:\Qt\Qt5.9.6_MinGW_static\lib文件夹中。
如果不执行此步,在Creator的Qt Version中将会显示“x86-windowsunknown-pe-32bit”。
3.将动态编译版本 C:\Qt\Qt5.9.6\5.9.6\mingw53_32\qml\QtQuick\Controls中所 有的文件拷贝到
C:\Qt\Qt5.9.6_MinGW_static\qml\QtQuick\Controls
如果有相同的文件则跳过。
(9)QtCreator的一些配置
大功告成
2024-05-30
windows11下安装qt5.15后,可能会有下面问题
C:\Qt\Qt5.9.6_MinGW_static\plugins\imageformats\libqjpeg.a(jerror.o):jerror.c:(.text+0x197): undefined reference to `_imp____acrt_iob_func' C:\Qt\Qt5.9.6_MinGW_static\plugins\imageformats\libqtiff.a(tif_win32.o):tif_win32.c:(.text+0x347): undefined reference to `_imp____acrt_iob_func' C:\Qt\Qt5.9.6_MinGW_static\plugins\imageformats\libqtiff.a(tif_win32.o):tif_win32.c:(.text+0x3f7): undefined reference to `_imp____acrt_iob_func' C:\Qt\Qt5.9.6_MinGW_static\lib\libQt5Gui.a(qpixmap.o):qpixmap.cpp:(.text+0x61): undefined reference to `_imp____acrt_iob_func' C:\Qt\Qt5.9.6_MinGW_static\lib\libqtlibpng.a(pngerror.o):pngerror.c:(.text+0x139): undefined reference to `_imp____acrt_iob_func' C:\Qt\Qt5.9.6_MinGW_static\lib\libqtlibpng.a(pngerror.o):pngerror.c:(.text+0x6e3): more undefined references to `_imp____acrt_iob_func' follow collect2.exe: error: ld returned 1 exit status mingw32-make[1]: *** [release\untitled63.exe] Error 1 mingw32-make: *** [release] Error 2 |
需要将gcc编译器改下就行