C++ is a powerful, widely-used language, but compilation isn’t very portable — on Windows, Turbo C++ and Borland C++ are common choices.

If you like to keep your programming environment in your pocket, this tutorial is for you. All you need is an Android device.

We can compile, execute, and debug C++ programs using AnDosBox on Android — a port of the classic DosBox emulator. It runs on Android 2.3 (Gingerbread) and up.

First, download the DosBox package. It’s a zip file, so extract it. You’ll get three things:

  • A folder called TC
  • A utility file
  • The AnDosBox APK

Move the TC folder to the root of your internal storage — it must not be inside a subdirectory:

/sdcard/TC (or /storage/emulated/0/TC)

The compiler needs to find the TC folder at a fixed path, so don’t nest it inside other folders.

After moving TC, install the AnDosBox APK.

Now open the DosBox app and type these commands:

cd tc
cd bin
tc

The commands are case-insensitive in DosBox.

  • cd = change directory
  • tc launches the Turbo C++ compiler

After entering those commands you’ll get the Turbo C++ compiler window. You have options for Run, Debug, Compile, and more. Make sure to save your file before executing.

Each time you reopen the app, you’ll need to re-enter those three commands.

Happy coding! ;-)