QT嵌入式程序,成功运行

来源:互联网 发布:乎加偏旁组新字再组词 编辑:程序博客网 时间:2024/09/21 09:29

1、QT下载地址:ftp://ftp.qt.nokia.com/qt/source/

2、环境搭建参考:http://mobile.51cto.com/symbian-273476.htm

博客里环境变量设置方法不错

3、建立arm示例程序test.cpp:

#include<QApplication>
#include<QPushButton>

int main(int argc,char **argv)
{
        QApplication a(argc,argv);
        QPushButton hello("hello,wrold");
        hello.resize(120,30);
        hello.show();
        return a.exec();
}

注test程序要用.cpp格式

4、按照另一篇博客,建立虚拟机与开发板的ftp连接,将编译好的test程序考到开发板里

5、直接运行的话会报error while loading shared libraries: libQtGui.so.4: cannot open shared object file: No such file or directory错误。

解决方法是编辑/etc/profile文件,将/usr/local/lib与/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib添加到LD_LIBRARY_PATH环境变量下:

TSLIB_ROOT=/usr/local/lib
LD_LIBRARY_PATH=/usr/local/Trolltech/QtEmbedded-4.6.3-arm/lib:$TSLIB_ROOT

export LD_LIBRARY_PATH

然后reboot

6、运行/test -qws 程序运行,搞定!

0 0
原创粉丝点击