All     Ethical Hacking     Networking     Programming     OSINT

C++ in Termux – Installation & Usage Commands

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 -y
pkg install clang -y

Create a C++ file:

nano hello.cpp

Add this code:

#include <iostream>
using namespace std;

int main() {
    cout << "Hello Termux!" << endl;
    return 0;
}

Compile the program:

clang++ hello.cpp -o hello

Run it:

./hello

Usage Commands

Compile any C++ file:

clang++ file.cpp -o output

Run the compiled program:

./output

Show compiler version:

clang++ --version

Show compiler help:

clang++ --help

Uninstall C++ compiler (clang):

pkg uninstall clang