C++ is a fast and powerful programming language used for system programming, apps, and game engines. Termux allows you to install a full C++ compiler on your Android phone so you can write, compile, and run C++ programs easily. Below are the installation steps and the basic usage commands.
Installation
pkg update && pkg upgrade -ypkg install clang -yCreate a C++ file:
nano hello.cppAdd this code:
#include <iostream>
using namespace std;
int main() {
cout << "Hello Termux!" << endl;
return 0;
}Compile the program:
clang++ hello.cpp -o helloRun it:
./helloUsage Commands
Compile any C++ file:
clang++ file.cpp -o outputRun the compiled program:
./outputShow compiler version:
clang++ --versionShow compiler help:
clang++ --helpUninstall C++ compiler (clang):
pkg uninstall clang