3
以下是我的步骤:为什么我不能编译这个命令行OpenCV Mac应用程序?
1)创建一个命令行工具项目 “的OpenCV”
2)添加文件到项目,该项目是在/ usr/local/lib目录后缀2.4.2,如 “libopencv_calib3d.2.4.2.dylib”
3)增加 “的/ usr /本地/包括” 项目的头文件搜索路径
4)键入此程序:
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.hpp>
int main(int argc, char** argv)
{
IplImage * pInpImg = 0;
// Load an image from file - change this based on your image name
pInpImg = cvLoadImage("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED);
if(!pInpImg)
{
fprintf(stderr, "failed to load input image\n");
return -1;
}
// Write the image to a file with a different name,
// using a different image format -- .png instead of .jpg
if(!cvSaveImage("my_image_copy.png", pInpImg))
{
fprintf(stderr, "failed to write image file\n");
}
// Remember to free image memory after using it!
cvReleaseImage(&pInpImg);
return 0;
}
不过,我得到错误:
ld: library not found for -lopencv_calib3d.2.4.2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
问题出在哪里?
我使用的是山狮的Xcode 4.4
是的,谢谢!顺便说一句,最新的opencv版本是2.4.2,为什么你的版本是2.4.9? – HanXu 2012-07-31 01:37:58
昨天我做了'git clone git:// code.opencv.org/opencv.git',这就是*/usr/local/lib *中的结果。 – SSteve 2012-07-31 03:49:50
嗨,大家好,我意识到现在这已经很老了,但我还没有真正能够找到任何足够清晰的文档来说明如何设置openCV.framework来与iOS进行编译。我添加了二进制OpenCV.framework的链接,并添加了标题和库搜索路径。我一直在四处寻找,我已经无法解决这个问题几天了。我不知道我错过了什么。谁能帮我? – 2016-04-06 16:01:35