How to compile and run a C / C ++ program on an Android system (e.g. MinGW on Windows)?

I want to compile and run a C / C ++ program in an Android phone program (e.g. G1).

For example, I write Hello World.c, then compile and run it on my Android phone system.

I have never used MinGW to run my code on my Windows system, so I also want to do this on an Android phone system.

+6
compiler-construction android android-emulator
source share
5 answers

During other answers, it may have been true that there were no development options. However, this area is changing rapidly. Now there are several projects where you can develop in some languages. Not all utilities support all ansi standards in languages. As an example, the C4droid project seems to be aiming at providing full ansi C / C ++.

https://play.google.com/store/apps/details?id=com.n0n3m4.droidc&hl=en

+6
source share

I would recommend CppDroid , the new free C / C ++ IDE and Android compiler. It has many C / C ++ examples and tutorials. YouTube: https://www.youtube.com/watch?v=4T5qNP6xJ6Y#t=14 Blog: http://cppdroid.blogspot.com , Google Play: https://play.google.com/store/apps/ details? id = name.antonsmirnov.android.cppdroid

+2
source share

Android does not have a C / C ++ compiler on its devices, sorry. There are ways to create C / C ++ libraries for use with Android (see NDK), but they are compiled on the host machine, and not on the device itself.

+1
source share

The only way to use C / C ++ in Android is to use the Android NDK .

+1
source share


today I just tried a new thing
these are super hacks, but it works great after you set it up.
start your phone first (use something as simple as z4root).
and follow the instructions here:
http://www.gphone.org.hk/cgi-bin/ch/threaded_show.cgi?tid=69&pid=222&h=1

If you find it difficult to use adb, then you are exactly like me.use QuickSSHd.
CHILDREN SET SECRET PASSWORD FOR QuickSSHd and OpenSSH.it will not make any changes to the process, but will help you not to be confused.
After you have done everything
make sure the last few statements work correctly. It may hurt

After, make sure that OpenSSH is installed correctly .
Close QuickSSHd and ssh in your Debian.

then you can apt-get install g ++

Refresh to compress after you make sure that it works.

And have fun.

Hint: never close the shell in the process == use usb instead of wifi if possible

Any questions, I'm ready.

+1
source share

All Articles