Linking OpenCV libraries in Xcode

2019-08-29 10:15发布

问题:

So I just installed OpenCV 2.4.0 using CMake, and the two relevant folders seem to be at usr/local/include/opencv and usr/local/include/opencv2. However, I'm at a complete loss when it comes to actually linking these with Xcode 4.2 for using it in an iphone app. I've been searching online for a solution, and while some exist, I'm either not doing the steps right nor do I seem to have the right files/folders in the right places, although I'm pretty sure it was installed correctly. Any help for a newbie would be much appreciated!

回答1:

I hope this is not the blind leading the blind here. I ran cmake with the xcode option:

cmake -G "Xcode" -D WITH_TIFF=OFF -D BUILD_EXAMPLES=ON ..

I do not see tutorials on how to proceed with the -G "Xcode" option, so here's my 2c worth.

Update:found a blog that uses -G "Xcode":Building OpenCV for Snow Leopard

After a LOT of thrashing I got results in my xcode build directories, opencv/build/lib/Debug.

I am just compiling command line utilities, so I set a new command line target, and in my target settings, under the 'Linked Libraries' section, I had to add all those libraries.

Sorry if that is all a bit vague. I didn't keep very good notes on all the steps.

So, see if you need to add some 'Linked Libraries' in your target settings.

On SE, see :this post