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



你可能感兴趣的:(LINUX)