行下写的问题已解决,但我面临一个新的相关问题。与以前略有不同,我将示例 OpenCV 代码编译并链接为:
g++ facedetect.cpp -o facedetection -I /home/harsh/Downloads/OpenCV-2.0.0/include/opencv/ -L/home/harsh/Downloads/OpenCV-2.0.0/lib/ -lcv -lcxcore -lcvaux -lml -lhighgui
现在没有任何错误,但是当我使用运行可执行文件时
./facedetection
我收到此错误:
./facedetection: error while loading shared libraries: libcv.so.2.0: cannot open shared object file: No such file or directory
当我进行符号链接时,使用:
ln -s libcv.so libcv.so.2.0
那么错误是:
ln: failed to create symbolic link 'libcv.so.2.0': File exists
不知道如何解决这个问题。
提前致谢..
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
我正在尝试创建一个示例 OpenCV 程序的 linux 可执行文件,该程序将与 .so 文件动态链接,并将在未安装 OpenCV 的机器上执行,但 .so 文件将出现在该 linux 机器上。
我已经搜索了很多关于此的帖子,但仍然没有成功。
我像这样编译opencv:
cd OpenCV-2.0.0/
cmake -DBUILD_SHARED_LIBS=ON .
make
然后在 OpenCV-2.0.0/lib 中创建所有编译的库
然后,在 samples/c 目录中,我这样做了:
g++ facedetect.cpp -o facedetection -I /home/harsh/Downloads/OpenCV-2.0.0/include/opencv/ -L/home/harsh/Downloads/OpenCV-2.0.0/lib/ -llibcv -llibcxcore -llibcvaux -llibml -llibhighgui
但错误是:
/usr/bin/ld: cannot find -llibcv
/usr/bin/ld: cannot find -llibcxcore
/usr/bin/ld: cannot find -llibcvaux
/usr/bin/ld: cannot find -llibml
/usr/bin/ld: cannot find -llibhighgui
collect2: ld returned 1 exit status