今天装了下Qt,折腾了一下.总结下.
假设已经安装了winXP和VS2005;
首先到http://qt.nokia.com/downloads/sdk-windows-cpp.下载Qt源文件.
到http://qt.nokia.com/downloads下载qt-vs-addin-1.1.7.exe (57 MB)
1.将Qt源码包解压到目录C:/Qt/Qt4.6.0-msvc2005。
2.通过"开始"菜单 -> "Microsoft Visual Studio 2005" -> "Visual Studio Tools", 运行命令行.
nmake /?
3.确保关闭了杀毒软件。
输入配置编译的命令行:
C:/Qt/4.6.0-msvc2005>configure -no-stl -no-dsp -vcproj
4.编译过程中,会问一个问题:
是否接受GPL协议,选'y'.
经过一段时间以后(15分钟),qmake被编译出来了.
删除
src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp
delete the src/script/tmp/moc/debug_shared/mocinclude.tmp
and the same file in release_shared.
接着编译一大堆代码,简单的敲入nmake即可.
5.配置环境变量
在PATH环境变量中添加:"C:/Qt/Qt4.6.0-msvc2005/bin".
添加新的环境变量,名字为"QMAKESPEC",值为"win32-msvc2005".
添加新的环境变量,名字为"QTDIR",值为"C:/Qt/Qt4.6.0-msvc2005".
6.安装Visual Studio的插件
qt-vs-addin-1.1.7.exe (57 MB)
7. 配置Visual Studio 2005.
"Tools" -> "Options" -> "Qt" -> "Builds", 添加我们刚才编译的Qt代码,名字为"Qt 4.6.0", 路径为"C:/Qt/4.6.0-msvc2005".
8.如果安装Visual Assist的话,需要配置一下,才有代码提示功能.
"VAssistX" -> "Visual Assist X Options ..." -> "Projects", 在"Platform"里面把"Win32"改为"Custom",
在"Stable include files"末尾添加"c:/Qt/4.6.0-msvc2005/include".
文件夹中Whole.Tomato.Visual.Assist.X有。
补充:用VS2005编译Qt程序时,还需设置编译环境。方法如下:
1。工具->选项->项目和解决方案->VC++目录->
2.在显示以下内容的目录中,分别设置
a.包含文件
C:/Qt/Qt4.6.0-msvc2005/include
b.库文件
C:/Qt/Qt4.6.0-msvc2005/include
参考文章
1.http://winsystem.ctocio.com.cn/371/11577371.shtml
2.http://cppblog.com/