Let's take a sample code:
Code:
#include <iostream> // No .h's for standard libraries anymore
using namespace std;
// All the standard headers use this namespace,
// so lets make it common.
// Else we type std::cout and std::endl, and so on.
// Just think of it as,
// cout, endl, cin, etc default functions
// belong to this large class
// (actually name-space) called std (standard).
int main () // main must always return int now on ...
{
cout<<"Hello"<<" "<<"World"<<endl;
return 0;
}
// Save as file.cpp
Now to compile this:
Code:
# Use g++, the default GNU C++ compiler.
g++ file.cpp -o outfile
# Outfile is the output (binary, executable) file name. By default it is a.out (Assembler.output)
To finally run out compiled binary:
Code:
./outfile # or use: sh outfile
Do all this in the terminal. If any other problem persists, do report here.