Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C++ » Compile C++ on Linux using g++ compiler

Compile C++ on Linux using g++ compiler

Create a C++ program using vi editor on Linux

Launch terminal and run vi program.cpp command. It will create editable file with name 'program.cp'

vi command to edit c++ code

Create "Hello World" Program in C++

Write C++ code which prints "Hello Word" on console

Hello World Program on Linux using vi editor

Compile using g++ and Run executable ./a.out

When a .cpp file is compiled using g++, then by default executable with name a.out is created, this executable can be run like ./a.out command.

running a.out file in linux

Other Categories

MCQ on C Programming MCQ on C++ Programming 138+C++ F2F Interview Questions Basic Computer Questions Solved C programs Solved C++ programs