qt使用记

qt使用opencv找不到库文件

错误

error while loading shared libraries: libopencv_core.so.3.4: cannot open shared object file: No such file or directory。

前提

在ubuntu下交叉编译了opencv与qt测试程序,把交叉编译好的库文件拷贝到开发板文件系统中。

解决

就是在环境变量中指定库文件路径,以便qt测试程序加载库文件。

 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/samba/imx6ull/tool/opencv-3.4.1/install/lib

这边应该是在arm上重新开辟了窗口问题

错误

 QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
OpenCV(3.4.1) Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /home/samba/imx6ull/tool/opencv-3.4.1/modules/highgui/src/window.cpp, line 636
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(3.4.1) /home/samba/imx6ull/tool/opencv-3.4.1/modules/highgui/src/window.cpp:636: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvShowImage

提示

如果你在Ubuntu或Debian上,安装libgtk2.0-dev和pkg-config,然后重新运行cmake或configure脚本。

伪解决

  sudo apt install libgtk2.0-dev pkg-config

也就是重新编译安装opencv。

原因

这边应该是我调用了opencv生成窗口的函数,因为在windows下可以正常显示,调用了2个窗口,这边不要在ubuntu下测试,因为opencv编译成了arm环境,其实重新配置应该是解决不了问题的,多半是你的程序调用了多个窗口,而在imx6ull上就会报错。

解决

可以设置qlabvl显示图片,发现问题解决,这边应该就先调试好环境再写应用代码,这里犯傻了,调试了好久。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值