Compiling a C++ Program

First create a file called helloworld.cpp:

#include <iostream>
using namespace std;

int main()
{
    cout << "Hello World" << endl;
    return 0;
}

Then run the command:

$ c++ helloworld.cpp -o helloworld

Followed by

$ ./helloworld
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License