我现在正在研究ios的opencv。从github.com/macmade下载示例代码后,我编译并运行程序,一切正常。但是,当我添加一些 opencv 代码如下:
IplImage* img = 0;
int height,width,step,channels;
uchar* data;
int hIndex,wIndex,cIndex;
img = cvLoadImage("tapme.png",CV_LOAD_IMAGE_COLOR);
if (!img) {
NSLog(@"img cannot load");
return;
}
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
data = (uchar*)img->imageData;
NSLog(@"%d:%d:%d:%d",height,width,step,channels);
然后我再次编译程序,一切正常。但是当链接时发生错误时:
Undefined symbols for architecture i386:
"_cvLoadImage", referenced from:
-[MainViewController showPic:] in MainViewController.o
stackoverflow中几乎所有的方法我都试过了,但是效果还是不太好。任何人都有修复错误的好主意,等待您的帮助并感谢您。