Captain Jack sparrow Captain Jack sparrow - 1 year ago 100
iOS Question

using an ios framework for native c++ code for ios

I have written a c++ library that needs opencv which is an image processing library. I want to now use this c++ library on ios. To do that I am going to copy my code to a mac and build to produce a cocoa touch static library.

Since, this has a dependency on opencv, I downloaded its ios framework. But now I am confused whether a framework can be used from c++ code or just from objective c/c++ ? Do I have to recompile this library so that i get c++ libraries or I can use the framework in my c++ code?

Answer Source

Yes, it can be used with c++. You will have to make sure you Type is set to "Objective C++ Source" for where you are making the framework calls.

I mix my C++ code with frameworks all the time.

Note this goes both ways. If you have Obj-C interacting with C++, you'll need to either have the file be a .mm or be of the "Objective C++ Source" Type.

The Type selection is in the File Inspector for files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download