2. Create the C++ file. Let’s call the c++ file – “HelloWorld.cpp”. I am using vi to create the following C++ file. You may use your preference editor.
$ sudo apt-get install build-essential
3. Once the cpp file is saved and it’s ready to compile now by using g++. Use the following command to compile our very first cpp file now.
using namespace std;
cout << "Hello World\n";
4. An executable HelloWorld is produced and ready to be executed by using the following command.
$ g++ HelloWorld.cpp -o HelloWorld
5. The output of the executable program is displayed as follow: