Nick
Nick

Reputation: 9860

Using OpenCV in Xcode project gives linker errors

After building and installing opencv via their cmake process, I took some suggested steps to integrate the libraries into an Xcode project.

And then I added a bit of demo opencv code. When I run this project, I get errors you'd expect from a linking problem:

Apple Mach-O Linker Error: Undefined symbols for architecture x86_64: "_cvCvtColor", referenced from:

Using file on the dylibs I include shows what I expect:

file /usr/local/lib/libopencv_core.dylib /usr/local/lib/libopencv_core.dylib: Mach-O 64-bit dynamically linked shared library x86_64

file /usr/local/lib/libopencv_highgui.dylib /usr/local/lib/libopencv_highgui.dylib: Mach-O 64-bit dynamically linked shared library x86_64

Both of these files are built for the proper architecture and (I think) properly added to the project. How can I debug other linker issues that I might be having? Where do I go from here?

Upvotes: 1

Views: 3044

Answers (1)

SSteve
SSteve

Reputation: 10738

cvtColor is in libopencv_imgproc.dylib. Add that to the "Link Binary with Libraries" phase and you should be good.

Upvotes: 7

Related Questions