Abhinandan Dharmadikari Abhinandan Dharmadikari - 1 year ago 187
iOS Question

How to use C, C++ program or classes in objective C (Xcode)?

Currently I am trying to use C++ class in objective C. I followed the steps of this website tutorial

So I am able to access and print "Hello C++" string on text box on button click. but how to access main function as already

is present in objective C.

I have included external "libzip" library which is zip-unzip operating library which is written in C and I want to access it in objective C so that, whenever i click on any button it should unzip specific directory in ios device and return data from that zip file.

#import <UIKit/UIKit.h>
#import "AppDelegate.h"

int main(int argc, char * argv[])
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));

I am totally new in XCODE and objective C.

Answer Source

Look in the folder "Supporting Files" for the file called main.m.

Rename it to main.mm

Now main is a c++ main.

enter image description here

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