您的位置:首页 > 编程语言 > Qt开发

arm qt-4.5.0更换为qt4.8.5

2015-12-28 10:27 399 查看
参考博客http://bbs.elecfans.com/jishu_459569_1_1.html

本想使用 QCustomPlot
在arm板上实现AD波形的实时显示,但是用的qt-4.5.3在x86上编译能够通过,也能运行出UI。但是用arm版的qt-4.5.3去编译报如下错误

In file included from ui_mainwindow.h:23,

from mainwindow.cpp:2:

./qcustomplot.h:42:21: error: QVector2D: No such file or directory

./qcustomplot.h:45:20: error: QMargins: No such file or directory

In file included from ui_mainwindow.h:23,

from mainwindow.cpp:2:

./qcustomplot.h:192: error: variable or field 'setMarginValue' declared void

./qcustomplot.h:192: error: 'QMargins' was not declared in this scope

./qcustomplot.h:192: error: 'margins' was not declared in this scope

./qcustomplot.h:192: error: expected primary-expression before 'side'

./qcustomplot.h:192: error: expected primary-expression before 'int'

mainwindow.cpp:116: error: expected `}' at end of input

Makefile:212: recipe for target 'mainwindow.o' failed

make: *** [mainwindow.o] Error 1

到qcustomplot的官网http://www.qcustomplot.com/index.php/download下载的QCustomPlot.tar.gz包都是只支持qt4.6以上的









我的qt版本正好是4.5的,只好将qt的版本更新至4.6以上 ,我去镜像站http://mirror.lzu.edu.cn/qt-all/archive/qt/4.8/4.8.5/下载了一个高一点的qt-everywhere-opensource-src-4.8.5.tar.gz


配置Qt

如下,先通过 --prefix 指定qt安装的路径,-I后面指定上一步tslib的include路径,-L后面指定上一步tslib的lib路径(一定要使用下面配置)

$ sudo mkdir /opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm

$ sudo ./configure --prefix=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm -opensource -release -shared -Declarative -importdir /opt/imports -fast -no-largefile -qt-sql-sqlite -qt3support -exceptions -xmlpatterns -no-glib -no-phonon -no-mmx -no-3dnow -no-sse -no-sse2
-svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng -qt-libjpeg -make libs -make tools -nomake examples -nomake docs -nomake demo -no-nis -no-cups -iconv -no-dbus -xplatform qws/linux-arm-g++ -embedded arm -little-endian -qt-freetype -depths 16,24,32 -qt-gfx-linuxfb
-qt-gfx-transformed -qt-gfx-multiscreen -no-gfx-vnc -no-gfx-qvfb -qt-kbd-linuxinput -no-kbd-qvfb -armfpa -no-mouse-qvfb -qt-mouse-linuxtp -qt-mouse-tslib -DQT_QLOCALE_USES_FCVT -DQT_NO_QWS_CURSOR -no-pch -I/usr/local/tslib/include -L/usr/local/tslib/lib -confirm-license

编译时间大概1个半小时,完了之后修改环境变量文件setARM_qt4.8.5_env如下:

#!/bin/sh

export QPEDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin

export QTOPIA_DEPOT_PATH=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin

export QTDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin

export DQTDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin

export QMAKE=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin/qmake

export UIC=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin/uic

export TMAKEDIR=/opt/EmbedSky/qt-4.8.5/qt-4.8.5_arm/bin

export TMAKEPATH=$TMAKEDIR/lib/qws/linux-arm-g++

export PATH=$QPEDIR/bin:$QTDIR/bin:$DQTDIR/bin:$TMAKEDIR/bin:$PATH

export LD_LIBRARY_PATH=$QPEDIR/lib:$QTDIR/lib:$DQTDIR/lib:$LD_LIBRARY_PATH

运行./setARM_qt4.8.5_env

然后hello_cn文件夹里运行arm_project文件

#!/bin/sh

$QMAKE -project

$QMAKE

生成.pro和Makefile文件

然后make一下生产hello_cn可执行文件,就可以拷贝到文件系统的bin目录下了。

由于之前arm板上的文件系统已经做好,包括触摸校验也做好了,现在只需要替换文件系统中opt/qt-4.5的/lib库和plugin库为opt/qt4.8.5的库,并且将opt/qt4.8.5/bin中的hello_cn(HELLOWORLD程序)替换。

环境变量中qt-4.5替换为qt4.8.5(etc/profile和bin/qt4中)。



最后制作镜像,拷贝后启动开发板就有UI了!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: