准备学习下QT,因为其在windows和linux的移植性。先得把环境搭建起来。
机器上本身装得有VS2005,所以就没去下最新的2008,先在网上查了下资料,大概都讲得七七八八,所以按部就班:
1:下载qt-sdk-win-opensource-2010.02.1.exe和qt-vs-addin-1.1.4.exe备用。
2:安装QT(qt-sdk-win-opensource-2010.02.1.exe),我装在了E:\Qt\2010.02.1
3:XP新增一个系统环境变量QMAKESPEC,值为win32-msvc2005,并且在系统环境变量的path中添加E:\Qt\2010.02.1\qt\bin
4:开启VS2005的命令行,然后转到E:\Qt\2010.02.1\qt执行
configure -debug-and-release -stl -platform win32-msvc2005 -no-dsp –vcproj
回答选择项,好像是关于license类型和啥
5:configure没有遇到问题,然后执行nmake
其间出现类似以下错误:
编译webkit组件时
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8.0\VC\BIN
\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
删除以下文件:
src/3rdparty/webkit/WebCore/tmp/moc/{debug,release}_shared/mocinclude.tmp
再试
忘记编译什么了
NMAKE : fatal error U1077: 'E:\Qt\2010.02.1\qt\bin\moc.exe' : return code '0x1'
查了一下,网上提到:
delete the src/script/tmp/moc/debug_shared/mocinclude.tmp
and the same file in release_shared.
then nmake it.照着做,然后似乎通过了
and the same file in release_shared.
then nmake it.照着做,然后似乎通过了
6:安装qt-vs-addin-1.1.4.exe
7:然后就可以在VS2005里面看见QT选单,可以创建application了。
8:简单写了一个main:
#include "hello.h"
#include <QtGui/QApplication>
#include <qwidget.h>
#include <qpushbutton.h>
#include <QtGui/QApplication>
#include <qwidget.h>
#include <qpushbutton.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget mainwindow;
mainwindow.setMinimumSize(200,100);
mainwindow.setMaximumSize(200,100);
QPushButton helloworld("hello world!",&mainwindow);
helloworld.setGeometry(20,20,160,60);
{
QApplication a(argc, argv);
QWidget mainwindow;
mainwindow.setMinimumSize(200,100);
mainwindow.setMaximumSize(200,100);
QPushButton helloworld("hello world!",&mainwindow);
helloworld.setGeometry(20,20,160,60);
a.setActiveWindow(&mainwindow);
mainwindow.show();
mainwindow.show();
return a.exec();
}
}
成功实现hello world!
©著作权归作者所有:来自51CTO博客作者wb127的原创作品,如需转载,请注明出处,否则将追究法律责任
0
收藏
推荐专栏更多
猜你喜欢
BAT批处理文件
oepnssh 无密码连接
Android开发学习笔记:浅谈WebView
发现大量的TIME_WAIT解决办法
Android开发学习笔记:Intent的简介以及属性的详解
vagrant打造自己的开发环境~~我也来一发
GNU开发工具——CMake快速入门
Jmeter之仿真高并发测试(集合点)
Android 音视频开发入门指南
Android音频开发(1):基础知识
Android开发学习笔记:浅谈ToggleButton
Python高级运维开发2016年7月第14期隆重开课
API网关如何实现对服务下线实时感知
浅谈ACL(访问控制列表)
Confluence 未授权 RCE (CVE-2019-3396) 漏洞分析
亿级日搜索量的美团如何构建高效的搜索系统?
玩转KVM:怎么追查KVM故障
mysql5.7.25主从同步图解(主:CentOS7.5,从win10)
springboot2+exporter+prometheus+grafana搭建监控体系
使用Alpine Linux和Oracle jre6构建Tomcat6镜像及应用容器化
扫一扫,领取大礼包
转载于:https://blog.51cto.com/wb127/401733
Ctrl+Enter 发布
发布
取消