Mar 5, 2011

Cocos2d and Opencv on iPhone

Good night! It has taken me all day to get cocos2d and opencv to play nice on the iphone.  First I couldn't link the files with the iphone project from opencv (static libraries).  Finally, I found this beautiful post.  It helped me compile opencv for iphone really quick.  Once that was done, I had to remove a few of the problems that cocos2d has with opencv.  Anything that XCode complained about, I stripped out of the opencv source.  Most of it was highgui calls.  Once that was done, I was able to link the libraries.  However, I then could not include the opencv headers in my project!!

I fixed this by realizing opencv has a problem with .mm files.  So, once I changed the class I am using opencv in to a .m file, cocos2d played nice with it.