SHARE

C4droid is a simple C/C++ compiler for Android which has full support of ANSI C and some support of ISO C99. With C4DROID you can now write your own C/C++ code and run them right on your Android mobile. C4DROID comes with Makefile assistance and uses TCC compiler (with optional GCC compiler). C4DROID Also Supports SDL/NativeActivity/Qt apps for GUI, to use it you need to install additional plugins listed at the end of this post.

Download-C4DROID-C++-Compiler-for-Android

Download: https://play.google.com/store/apps/details?id=com.n0n3m4.droidc

Compiling C++ projects:

  1. Make sure you have Enough internal memory.
  2. Install GCC plugin (C4droid will ask you to install it).
  3. Select G++ compiler in C4droid preferences.
  4. Use iostream, not iostream.h
  5. Add “using namespace std;” to your program (before int main)

Compiling Makefile projects:

  1. Open any file in the same folder with Makefile and long-click “Compile” to configure current directory (C4droid will create .c4droid configuration file when you’ll press Ok).
  2. After configuring folder, you can press compile button and C4droid will build your project.
  3. Don’t forget to enter executable name and select compilation mode (and press ok also, else changes will be discarded)

Compiling SDL/NativeActivity/Qt apps:

  1. To compile SDL/NativeActivity/Qt apps, you need GCC/G++ compiler selected (TCC is not supported).
  2. So First Install “GCC plugin for C4droid” from Google playstore.
  3. Now install “SDL plugin for C4droid“. Once you have installed both the plugins, you can now compile SDL/NativeActivity/Qt apps
  4. Make sure while compiling, GCC/G++ compiler selected is selected as TCC is not supported.
  5. SDL is detected with #include “SDL.h”, NativeActivity is detected with #include “android_native_app_glue.h”, Qt is detected with #include “QtGui”.

[ * ] If you have any “Illegal instruction” error, using internal compiler (TCC), Use GCC plugin instead, GCC supports softfloat (by default).

7 COMMENTS

  1. I am using samsung galaxy note 2 with android 4.1.2. I am unable to select G++ from the preferences, as it asks me go update GCC from google playstore. But when I go to google playstore, I find that I have already installed GCC and the update option is not there.

  2. Yo Dude, welcome to c++ family!

    Your small c++ “Hello..” stuff won t compile.

    You must use

    std::cout,

    not

    std::count,

    Great tutorial anyway! ;^

  3. , I’m not sure what versions of Cygwin’s gcc4 were aronud back when I posted this in May, 2011, though they may have been the samme.I updated the Cygwin Wikia page to reflect this new information, including mention of gcc4.

LEAVE A REPLY