gpt4 book ai didi

c++ - OpenCV: "libopencv_core.so.2.3: cannot open shared object file: No such file or directory"

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:52:48 30 4
gpt4 key购买 nike

我刚刚在我的 Debian 机器上安装了 OpenCV,但遇到了一些问题。我遵循了 Wiki 上的安装指南。尝试编译示例给出了似乎是成功的编译,但是尝试运行它们最终会抛出错误:

fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ g++ -Wall em.cpp
-lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video
-lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect
-lopencv_contrib -lopencv_legacy
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ ./a.out
./a.out: error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ pkg-config opencv
--libs-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
-lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d
-lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$

但即使这样做也行不通:

fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ g++ -Wall em.cpp
`pkg-config opencv --cflags --libs`
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ ./a.out
./a.out: error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$

我认为链接存在问题,但我不太确定发生了什么。这是 OpenCV 的全新安装——我以前从未在这台机器上安装过它。有人有什么想法吗?

最佳答案

sudo ldconfig

由 anon.coward 建议

关于c++ - OpenCV: "libopencv_core.so.2.3: cannot open shared object file: No such file or directory",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9661547/

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