Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing C/C++ Compilers in Android

Is there any way to have C/C++ compilers directly into the Android device ?

Something like I can adb shell the device and run gcc or agcc or something related to compiling C\C++ src files.

I googled, but there were just speculations, please help in this !

Thanks in Advance :) :) Shoaib

like image 341
Sam Avatar asked Aug 17 '11 10:08

Sam


People also ask

Can I compile C on Android?

You can add C and C++ code to your Android project by placing the code into a cpp directory in your project module. When you build your project, this code is compiled into a native library that Gradle can package with your app.

Which C compiler is best for mobile?

Arguably the most popular mobile IDE for programming in Java and C++, AIDE is a huge coding suite aimed at programmers of all levels. It allows to create C/C++ NDK and Java/XML apps for Android, as well as pure Java console applications.

How do I download GCC compiler on Android?

The GCC Compiler Plugin For C4Droid Android Application is available to download for Free on Google Play. You will get the link to Download GCC For Android at the bottom of this article. To Install GCC Plugin For Android Smartphone, you need to install two other plugins: SDL Plugin.


2 Answers

If you install c4droid you can make an onboard executable by finding the gcc binary and calling it. I also have root on my phone. On your phone or tablet: Install c4droid(paid app) and additionally GCC plugin(free). Install a terminal client. I use Better Term but there are free options as well.

find / -name gcc /mnt/sdcard/Android/data/com.n0n3m4.droidc/files/gcc/bin/arm-linux-androideabi-gcc

cat > test.c

#include<stdio.h>
int main(){ 
  printf("hello arm!\n");
return 0;
}

./mnt/sdcard/Android/data/com.n0n3m4.droidc/files/gcc/bin/arm-linux-androideabi-gcc test.c -o test

./test

hello arm!

like image 63
elahtrebor Avatar answered Oct 01 '22 19:10

elahtrebor


Try C4droid https://market.android.com/details?id=com.n0n3m4.droidc or this app https://market.android.com/details?id=GDE.Main

like image 35
Mike Avatar answered Oct 01 '22 20:10

Mike