xulei@xulei-PC:/opt/apps/xltest/files$ ./xltray
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".
Available platform plugins are: dde-kwin-xcb, dxcb, eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.
Reinstalling the application may fix this problem.
启动qt界面程序报错。这是什么原因呢,按照提示重新安装程序可以解决问题?当然不会的,这个是系统环境问题。
ldd 查看 xltray并不缺少依赖库,其实不用ldd也知道不缺少依赖库,因为缺少依赖库的话会报找不到对应的共享库文件。elf缺少依赖库的报错如下:
error while loading shared libraries: libxltest.so.1: cannot open shared object file: No such file or directory
我们从提示上看出是“load the Qt platform plugin "xcb” 出的问题,那么意味着是Qt平台插件相关的错误。
Qt平台下的编程中包含了插件模式,使得程序的扩展性非常好,但是插件的动态加载的检查也比较严格,出现错误的可能性也大大增加,无法加载的原因有多种:
- 找不到文件,编译的插件共享库库没有放在正确的rpath目录下;
- 插件库运行还依赖其他库,如果系统没有