1. 下载安装包
首先需要下载qt4.8和编译器mingw4.8.2的安装包,下载地址如下
- qt-opensource-windows-x86-mingw482-4.8.6-1.exe - https://download.qt.io/archive/qt/4.8/4.8.6/qt-opensource-windows-x86-mingw482-4.8.6-1.exe
- i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z - https://download.qt.io/development_releases/prebuilt/mingw_32/i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z
2. 配置编译器目录并安装
将下载下来的i686-4.8.2-release-posix-dwarf-rt_v3-rev3.7z解压,将文件夹中的mingw32文件夹放在自己需要的路径,这个路径要记住。
接着双击qt安装包qt-opensource-windows-x86-mingw482-4.8.6-1.exe进行安装,在Find installed MinGW这一页选择上一步中mingw的存放路径,接着点Install等待安装完成即可。
3.配置Kit
打开QtCreator(随便哪个版本都行,只要是安装了Qt5都有的),点工具→选项
首先在编译器中添加编译器,名称自定,路径选择mingw文件夹中的gcc.exe
接着在Debuggers中添加gdb,名称自定,路径选择mingw文件夹中的gdb.exe
然后在Qt Versions中添加qt4.8.6,名称自定,路径选择qt安装目录下bin下的qmake.exe
最后在Kits添加一个kit,名称自定,按下图配置
其他问题
问题:添加qt version时,显示no compiler can produce code for this qt version......
原因:安装时未配置正确的mingw路径,或在添加qt version前,未添加编译器和gdb。