本文主要是介绍export QT_DEBUG_PLUGINS=1,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Qt的编程中包含了插件模式,使得程序的扩展性非常好,但插件的动态加载的检查也比较严格,这次编译数据库驱动插件就碰到了不少问题。实际上,可以在系统的 环境变量中设置QT_DEBUG_PLUGINS=1 ,即在终端中执行 export QT_DEBUG_PLUGINS=1
再执行程序加载插件时,再系统控制台上会输出许多加载插件时的调试信息,可以清楚的看到系统尝试加载了哪些插件,哪些是成功的,哪些没有成功,原因是什么都写的比较清楚。因此,如果自己编译的插件库无法加载,可以用这个方式检查以下到底是哪里的问题。
//-------------------------------------
在没有添加QT_DEBUG_PLUGINS=1时,运行程序:
Open: "/dev/ttyO1"
Open: "/dev/ttyO4"
+++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++Create Command Thread.....
+++++++++++++++++++++++++++++++++++++++++++++++++++.
defaultServiceProvider::requestService(): no service found for - "org.qt-project
.qt.audiosource"
Input Devices Can Used :
()
===========
Default Input Devices :
""
-------------------
Encoder:
//-------------------------------------
添加QT_DEBUG_PLUGINS=1(即在即在终端中执行 export QT_DEBUG_PLUGINS=1)
//-------------------------------------
Open: "/dev/ttyO1"
Open: "/dev/ttyO3"
Open: "/dev/ttyO4"
QFactoryLoader::QFactoryLoader() checking directory path "/workspace/mediaservic
e" ...
QFactoryLoader::QFactoryLoader() looking at "/workspace/mediaservice/libqtmedia_
audioengine.so"
+++++++++++++++++++++++++++++++++++++++++++++++++++.
++++++++++++++++++++++++Create Command Thread.....
+++++++++++++++++++++++++++++++++++++++++++++++++++.
QElfParser: '/workspace/mediaservice/libqtmedia_audioengine.so' is an invalid EL
F object (string table seems to be at a100)
"'/workspace/mediaservice/libqtmedia_audioengine.so' is an invalid ELF object (s
tring table seems to be at a100)"
not a plugin
defaultServiceProvider::requestService(): no service found for - "org.qt-project
.qt.audiosource"
Input Devices Can Used :
()
===========
Default Input Devices :
""
-------------------
可以看到 提示的更详细,libqtmedia_audioengine.so 有问题,再排查吧
这篇关于export QT_DEBUG_PLUGINS=1的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!