Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android C++ and NOT C

I'm trying to decide if using C++ to create an Android app is sensible. I've tried to use Java for what I want, but it simply doesn't have the language features I need.

I see a bunch of things written as C/C++, but everyone of them are actually 'C' examples.

I'd like to build a simple C++ app (NOT 'C') to better understand how to do this in Android. I've read some about the NDK which seems to support C++, but I don't know to what extent.

Is there a sample C++ project out there? One that has real C++ and not C code inside a .cpp file? An "Hello World" program would be fine. Simple is good to start.

Please pass by this question if you want to answer with how C++ wraps a 'C' function. If the example doesn't address name mangling, it's not C++. No extern 'C' please. Thanks for understanding.

like image 393
Mitch Avatar asked Dec 28 '25 20:12

Mitch


1 Answers

NDK works really fine. It is so simple that you have your .cpp and .h written in C++, compile them with ndk-build, and you have your android code including the cpp's like explained this tutorial shows:

Good luck: Part 1 Part 2

Official documentation: Sample applications

like image 178
Jav_Rock Avatar answered Dec 31 '25 09:12

Jav_Rock