All pastes #673429 Raw Edit

Miscellany

public text v1 · immutable
#673429 ·published 2007-08-28 12:05 UTC
rendered paste body
// my first program in C++

#include <iostream>
using namespace std;

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

With g++:
kauer@karl:~$ g++ -o helloworld helloworld.c
kauer@karl:~$ ./helloworld
Hello World!kauer@karl:~$ 

With gcc:
kauer@karl:~$ gcc -o helloworld helloworld.c
helloworld.c:3:20: error: iostream: No such file or directory
helloworld.c:4: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’
helloworld.c: In function ‘main’:
helloworld.c:8: error: ‘cout’ undeclared (first use in this function)
helloworld.c:8: error: (Each undeclared identifier is reported only once
helloworld.c:8: error: for each function it appears in.)