标题:qtopia-opensource-4.3.0 在x86编译,编写hello小程序,运行在qvfb上
作者:wrduan
日期:2008-05-16 19:33
内容:
qtopia-opensource-4.3.0 x86环境下程序开发
关于移植qtopia4到开发板上的文章已经很多了,但是还是经常开到有些人对qtopia的本地开发不明白(包括我自己),尤其是从原来版本过度到4版本,很多东西不一样了所以不知道如何入手,我这里将我的入门过程记录如下希望能给大家一些帮助,如有不对的地方请大家及时提出,以免耽误别人的学习,下面的这些内容存属我个人的操作经过记录。
系统:虚拟机安装 fedora 8
标准的c++开发环境
gcc 4.1.2
标准的x86编译过程。
1.下载 qtopia,这里我用的是:qtopia-opensource-src-4.3.0.tar.gz 你可以到trolltech 的网站上下载,这个好像我是从 www.qtch.org 的embedded/qtopia 版上下载的。
2. 用root权限添加一个普通用户 devqt。因为qpe是不能在超级用户下执行的(这个应该是是我当时通过root用户执行时系统有提示,当时没有深究,这里谢谢shiroki给我的提醒,我会测试一下,谢谢shiroki)。然后用devqt登录系统。将下载的qtopia-opensource-src-4.3.0.tar.gz放到 devqt用户的目录下。后面的操作如没有特别说明都是在devqt用户环境下执行的。
3.解压文件到devqt下(实际路径是/home/devqt):$tar zxvf qtopia-opensource-src-4.3.0.tar.gz .4.建立一个编译用目录:$mkdir debugx86build
5.切换到debugx86build目录:$cd debugx86buld
6.执行configure进行配置:$echo yes|../qtopia-opensource-src-4.3.0/configure -debug -profile
7.configure完成后执行 make:$make#这一步用时比较长,当然和机器配置有关。
8.如果没有错误,完成后就可以执行:$make install#其实configure完成后系统会提示你下一步怎么做的。
9. 好了可以开始我们的qtopia本地程序的编译了,建立hello例程:$mkdir -p /home/devqt/hello
10. 编写一个hello.cpp的程序:$vim hello.cpp #代码内容如下:
#include
#include
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
QPushButton hello("Hello world");
QObject::connect(&hello, SIGNAL(clicked()), &app, SLOT(quit()));
hello.sho ..
#1 [wrduan 05-16 20:06]
很多人都是在摸索着学习,希望那些已经很流畅的进行qtopia4开发人的高人可以给些总结性的帮助。
#2 [linus8866 06-12 13:56]
I followed you step, but when i input gmake -project, it show me the following information. Do you know how and why?
# GNU Make 3.81
# Copyright (C) 2006 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions.
# There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
# This program built for i386-redhat-linux-gnu
# Make data base, printed on Thu Jun 12 13:17:04 2008
# Variables
# automatic
#3 [shiroki 06-12 15:58]
有个小问题。文章中说qpe不能在root用户权限下运行,不知道楼主是怎么得到的这个结论呢。事实上有些功能不用root用户就不能用了哦,比如modem, 普通用户是不能打开串口设备的。
#4 [wrduan 06-16 15:04]
“I followed you step, but when i input gmake -project, it show me the following information. Do you know how and why?
” 这里用的不是gmake 而应该是qmake。
#5 [bestvalentin 06-16 17:05]
感觉很不好用啊,尤其是做界面的时候,我用4.2.0