Compiling and running C/C++ is very easy in Linux/Ubuntu without installing any compiler. But to use before gcc for C and g++ must have to installed on your operating system, otherwise your program code will not be compiled. If you don't install this, please install GCC and G++ before using compilation and then follow the below step by step to compile c/c++ in Linux.
Compile and Run C/C++ Program in Linux/Ubuntu

Compile C in Linux/Ubuntu


Step-1: Open Terminal by Ctrl + Alt + T
 
Step-2: Command the below line to create New C File:
gedit filename.c
Here filename.c is the name of c program file with extension.

Step-3: Save the file by Ctrl + S and exit from gedit.

Step-4: Command the below line to create object file:
gcc filename.c ­o filename
Step-5: Command the below line to run your C file:
./filename

Compile C++ in Linux/Ubuntu

Step-1: Open Terminal by Ctrl + Alt + T
 
Step-1: Command the below line to create New C++ File:
gedit filename.cpp
Here filename.cpp is the name of C++ program file with extension.

Step-3: Save the file by Ctrl + S and exit from gedit.

Step-4: Command the below line to create object file:
g++ filename.cpp ­o filename
Step-5: Command the below line to run your C++ file:
./filename

If it has helped you, don't feel hesitate to comment. Happy Coding !

You can compile C/C++ on Sublime Text.