how to compile and run C++ with G++ code example Example: compile c++ program $ g++ -o <name-you-want-to-give> source.cpp $ ./myprogram