Skip to content
Back to home
Tutorial

C++ on Android: What Runs Today and What Doesn't

C++ files open and highlight in PocketCode, but they can't be run yet: the Clang pack can't be installed. Here is what works today, starting with C and TCC.

Updated:
2 min
By Pelayo Naredo
C++ on Android: What Runs Today and What Doesn't

C++ needs a serious compiler, which is exactly why people assume it's off-limits on a phone. To be straight about it: C++ does not run in PocketCode today. This post explains what that means, and what you can compile and run on the phone right now.

Where C++ stands

You can open, edit and save C++ files: the editor highlights C++ and has a built-in formatter for it, with a symbol bar for the punctuation. What is missing is everything that executes it:

  • No runner. Run is greyed out on a .cpp file.
  • No installable compiler. The plugin manager (Settings → Compilers and runtimes) lists a Clang-based C++ pack, but it can't be installed in this version.
  • No C++ language server. clangd is a native program, and Google Play doesn't allow apps to download native code, so there is no one-tap server for C++.

We don't count C++ among the languages the app runs.

What you can do today: C with TCC

If what you want is compiled, native-style code on the phone, C works now. The app bundles the TCC compiler, so a .c file compiles and runs on the device with nothing to download — see compile and run C on Android.

  • Real compilation, with genuine compiler errors and warnings.
  • printf, standard headers, pointers, structs and arrays — the C you'd write while learning or prototyping.
  • It all runs on the device and nothing leaves it. (You need a connection to sign in; opening the app with a session already started works offline; after that it's local.)

It's also a good way to learn the memory model that C++ builds on. To build and run real C++, use a desktop or a server you reach over SSH.

What else runs on the phone

If you want to practice typed languages today, Kotlin and Java (experimental and limited, through the BeanShell interpreter: classes with objects, generics and lambdas don't run) run on the device too, as do Python, JavaScript and TypeScript, Ruby and PHP. Go, Lua and Rust-style scripts are optional packs. See the full lineup.


C++ doesn't run yet; C, Kotlin, Python, JavaScript and more do, on your phone today.

PocketCode is available on Google Play. Get PocketCode to try it on your own device.

The tool behind this article

Code Editor

Ready to try PocketCode?

Download the app and start coding from your mobile.