Cintu
Cintu

Reputation: 913

Can we add C++ files into iOS project?

Can we add C++ files into ios project? if so then what all the build settings we need to do? Is apple accepts C++ code inside ios project?

Upvotes: 0

Views: 843

Answers (3)

Sumit Sharma
Sumit Sharma

Reputation: 1867

@Cintu : You can add C++ files in X-Code like this.

Since Objective-C is a extension/Super-set of C.enter image description here

Upvotes: 1

Fahri Azimov
Fahri Azimov

Reputation: 11770

Yes, you can use c++ files inside ios project. And, Yes Apple accepts your app, unless it uses private frameworks.

Upvotes: 0

Hampus Nilsson
Hampus Nilsson

Reputation: 6822

You don't need to do anything special. Just add the files to the project, as long as they have a .cpp or .cxx extension they will compile fine.

If you want to use C++ objects in Objective-C code you need to compile in "Objective-C++" mode, do this by naming your implementation files .mm instead of .m, then you can use C++ objcets inside your Objective-C classes and methods.

Upvotes: 3

Related Questions