For anyone who’s tried installing Qt4 on Windows you’ll no doubt have had a few problems. Here’s the steps I had to go through to get it working…
- Make sure you have MinGW installed. I’m using version 4.1.0.
- Download the file qt-win-opensource-desktop-4.0.0.zip from Trolltech’s website
- Extract it to the directory where you want to install Qt, e.g.
c:/qt/4.0.0 - Open a command prompt and cd to the directory
c:/qt/4.0.0 - Run the configure program like this,
configure -platform win32-g++. You have to use the win32-g++ platform (MinGW) because win32-msvc (MS Visual Studio) is not supported in the open source version of Qt (see here for a lively debat on the topic). If you try runningconfigure -platform win32-msvcyou’ll get to accept the license agreement but the configure program will just exit straight away with no explaination of what happened - Ensure that the MinGW bin directory is in your PATH environment variable. It’s very important that if you have MSYS installed that it is NOT in your PATH. If it is then the next step will fail because it picks up the cd program from MSYS and fails when trying to cd to windows formatted paths (i.e. paths using / instead if /)
- Run
mingw32-make.Note that this step takes quite some time (> 1 hour). Note also that you’ll need at about 2GB of disk space to hold all the files built as part of this step. - Finally add
c:/qt/4.0.0/binto your PATH environment variable. Ensure also that MinGW is on your PATH so that the Qt applications can find the MinGW binaries at runtime.
这里有个问题就是如果configure过程出现错误,怎么办?
我一直遇到的一个问题是mingw32/bin/ld.exe: cannot find -lQtGuid4 。。。
原因可能是qt安装的过程中没有自动配置成debug输出,使用qt安装目录下的一个bat文件,将qt的默认编译输出改为debug模式,中间调用的是configuration程序,但是这个过程最后是一错误告终的,还是有问题,搞不清楚
本文详细介绍了在Windows环境下安装Qt4的具体步骤,包括确保已安装MinGW、下载并解压Qt安装包、运行配置程序、编译安装等,并解决了安装过程中可能遇到的问题。
2828

被折叠的 条评论
为什么被折叠?



