UBUNTU下QT开发应用程序常见错误及其解决办法

错误:helloworld直接报错...:-1: error: cannot find -lGL

原因:缺少GL库

解决办法:sudo apt-get install libgl1-mesa-dev


下载了最新的qt-everywhere5.3.1版本的,交叉编译移植到板子上以后直接创建了一个Qt Quick程序放到板子上跑,提示了如下错误,网上找不到解决方法,求如何解决这个问题,感谢。
# ./qmlpng
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
QQmlApplicationEngine failed to load component
qrc:///main.qml:1 module "QtQuick" is not installed
qrc:///main.qml:2 module "QtQuick.Controls" is not installed
qrc:///main.qml:1 module "QtQuick" is not installed
qrc:///main.qml:2 module "QtQuick.Controls" is not installed


没有指明qml的路径,在环境里添加:export QML2_IMPORT_PATH=$QTDIR/qml就能解决qrc:///main.qml:1 module "QtQuick" is not installed这样类似的问题,$QTDIR/qml是你编译安装后会有个文件夹的。
不过我还是没能继续跑起来,我遇到以下问题:
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaB


或者试试export QML_IMPORT_PATH=$QTDIR/qml,不是很清楚具体是什么,可能是建立的工程不同而不同。。。


谢谢你的回答,确实是加上export QML2_IMPORT_PATH=$QTDIR/qml这句话解决了可以运行了,这些
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
只是警告而已,让运行起来的quick程序强制全屏且无法退出界面只能重启板子。
另外谢谢其他人的回复,就不一条条感谢


原地址:http://www.qtcn.org/bbs/read-htm-tid-56902.html



  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值