C/C++ support is usually already there on Ubuntu
1g++ --version
2gcc --version
build-essential
build-essential
includes gcc
, g++
and make
as well as libc-dev
1sudo apt install build-essential manpages-dev
The file extension is .cpp
on Linux or .C
Sample program
hello.cpp
1#include <stdio.h>
2
3int main() {
4 printf("bonjour le monde!");
5 return 0;
6}
g++ hello.cpp
By default it’ll generate a file called a.out
1g++ hello.cpp -o output
output
will be the generated binary file
1./output