objective c - Can you use C++ libraries in a Cocoa (Obj-C) project? -


i'm considering learning objective-c , cocoa, in order use apple's tools , guis.

however, i'd graphics programming; openframeworks , cinder 2 libraries catch eye, we're in c++ land.

i come java/swing/processing background... don't know c family. how can call c , c++ libraries, cinder , of, native cocoa?

and, bonus points: solution work on iphone or ipad?

in short, c++ fine os x , ios programs, , plays objective-c quite nicely.

in more detail:

however, i'd graphics programming; openframeworks , cinder 2 libraries catch eye, we're in c++ land.

i won't speak libraries directly.

to answer question in more general terms: c++ fine in app, since c, c++, objc, , objc++ first class development languages ios apps.

i come java/swing/processing background... don't know c family. how can call c , c++ libraries, cinder , of, native cocoa?

objective-c++ allows use c, c++, , objective-c in same translation. feel free use/combine c++, c, or objc needed. compile times increase, , there restrictions* if take route. otherwise, support good. apple uses amount of c++ in apps/libs.

and, bonus points: solution work on iphone or ipad?

definitely. c++11 support ios , os x bit behind. however, clang team's been adding support very quickly. there bumps if want latest features, i'd hold on bleeding edge c++ , compiler features if project depends on it. of course, not hurt sample program using latest clang features each release in order determine how works programs.

update: @ point (nov 8, 2011) clang can handle of c++ 2003 code throw @ it. code speed , size vary compared gcc+llvm. not want drop either @ point, both compilers work me c++ 2003, , apple's gcc not support c++11, it's time start testing clang if want c++11 features in near future.

  • c++ ideal (imo) general performance critical development on ios, long team knows how use it.
  • mixing c, objc , c++ powerful if use right features of each language right reasons, , compatibility exists. reaches years os x (although compiler gcc @ time).

*restrictions: these reasonable restrictions - features need exist, there things people may expect not possible. common inability derive types of different object models. is, cannot reasonably not create c++ type objc type, can freely declare ivars of multiple types in either object type.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -