未找到有关 opencv 的架构 i386 的符号 [英] symbol(s) not found for architecture i386 about opencv
问题描述
我现在正在学习opencv for ios,从github.com/macmade下载示例代码后,编译运行程序,一切正常.但是,当我添加一些 opencv 代码时:
I am studying opencv for ios now.After I download example codes from github.com/macmade, i complie and run the program, everything is OK. However, when i add some opencv codes as bellow:
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);
然后我再次编译程序,也一切正常.但是当链接时发生错误时:
Then i compile the program again, everything is OK too. But when errors happen when linking:
Undefined symbols for architecture i386:
"_cvLoadImage", referenced from:
-[MainViewController showPic:] in MainViewController.o
我已经尝试了几乎所有stackoverflow中的方法,但结果仍然不是那么好.任何人都有修复错误的好主意,等待您的帮助并感谢您.
I have tried almost all methods in stackoverflow, but the result is still not so good. Anyone have a good idea to fix the bug, waiting for ur help and thank u.
推荐答案
当您为模拟器构建时,链接器将需要一个适用于 i386 架构的库.当您为设备构建时,链接器将需要一个用于 arm 架构的库.您的模拟器构建设置是否指向正确的库?
When you build for the simulator, the linker will need a library for i386 architecture. When you build for a device, the linker will need a library for arm architecture. Do your simulator build settings point to the correct library?
这篇关于未找到有关 opencv 的架构 i386 的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!