gpt4 book ai didi

eclipse - libopencv_highgui.so.3.4 : cannot open shared object file: No such file or directory in the eclipse ide for cross compiler

转载 作者:行者123 更新时间:2023-12-04 19:09:09 26 4
gpt4 key购买 nike

我遇到了一个问题。我为嵌入式系统开发交叉编译。我为 arm_linux-gnueabihf 构建了 opencv。

我的 ubuntu 版本是 18.04.2 x86_64 5.3.0.51-generic。

那个问题

libopencv_highgui.so.3.4: cannot open shared object file: No such file or directory I build the project success but when I run the project, I get the problem



这是我的代码
#include <iostream>
#include <stdio.h>
#include <cv.h>
#include <opencv2/videoio.hpp>
#include <opencv2/core.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;

int main(int, char**){
Mat frame;
VideoCapture cap;
int deviceId = 0;
int apiId = cv::CAP_ANY;
cap.open(deviceId,apiId);
if (!cap.isOpened()){
cerr<<"Error! Unable to camera\n";
return -1;
}
for(;;){
// read frame
cap.read(frame);
if (frame.empty()){
cerr <<" ERROR ! black frame grabbed ! \n";
break;
}
imshow("Live",frame);
if (waitKey(5) >= 0){
break;
}
}
return 0;
}

我检查了图书馆如下:

sudo find / -name "libopencv_highgui.so.3.4"



返回的命令如下
/usr/local/lib/libopencv_highgui.so.3.4
/usr/local/lib/libopencv_highgui.so.3.4.4
/usr/local/include/lib/libopencv_highgui.so.3.4
/usr/local/include/lib/libopencv_highgui.so.3.4.4

我在 中创建了一个文件/etc/ld.so.conf.d/opencv.conf 包含
/usr/local/lib
/usr/local/include

然后我运行sudo ldconfig -v的命令,它返回如下
/sbin/ldconfig.real: /usr/local/lib/libopencv_highgui.so.3.4.4 is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_imgproc.so is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_xfeatures2d.so is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_bgsegm.so.3.4.4 is for unknown machine 40.

/sbin/ldconfig.real: /usr/local/lib/libopencv_objdetect.so.3.4 is for unknown machine 40.

以及其他opencv的库。

我为库配置了eclipse的设置,如下所示:

跨 G++ 编译器中的“包含”文件夹
Includes

跨 G++ 链接器中的“库”文件夹
Libraries

最后,我在 Eclipse 设置的调试中添加了 LD_LIBRARY_PATH
Path Conf.

我尝试了 sudo apt update 和 sudo apt upgrade 命令,但我仍然收到错误消息。

有人有建议吗 ?

最佳答案

解决方案是将“/usr/local/lib”添加到环境中的 LD_LIBRARY_PATH。
我的是LD_LIBRARY_PATH /usr/arm-linux-gnueabihf/lib/:usr/local/lib/

关于eclipse - libopencv_highgui.so.3.4 : cannot open shared object file: No such file or directory in the eclipse ide for cross compiler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61624400/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com