Calling Objective-c functions from C++

Calling Objective-c functions from C++
0.0 0


I am trying to integrate Facebook plugin (objective-C) with cocos2dx.
I can successfully run the code in application didFinishLaunchingWithOptions inside

This code runs when the application starts (in objective-c), but how do I invoke this code from a CCScene or a CCLayer (in .cpp instead of .mm) ?



May be you should do like this:

// xxx.h
class FacebookPlug
   // some functions 

//, invoke the objective-c to implement it

Then, other c*+ code can include xxx.h, and use it like a normal c*+ class.


I’m not sure what Zhang means… did you get this to work?… i’d like to know this also.


You can refer


Got it, thanks for that.