delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/02/09:42:14

Message-ID: <30C9E24891FFD411B68A009027724CB702C04E76@eg-002-015.eglin.af.mil>
From: Keen Wayne A Contr AFRL/MNGG <keenwa AT eglin DOT af DOT mil>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: Bug in...
Date: Thu, 2 Jan 2003 08:42:26 -0600
X-Mailer: Internet Mail Service (5.5.2653.19)
Reply-To: djgpp AT delorie DOT com

Did you remember to include the standard namespace in your code?
Also, did you compile your code with gpp?

I would be very careful before starting to call something a
bug in the distro, you would be surprised how many people
think they know how to write "Hello World", and really do
not because:

(1) They don't know about the C++ header standards change that
means you should 
#include<iostream>

(2) And, as part of (1), that the function names like cout are
now in the standard namespace, so you either have to include
using namespace std;
or qualify your names, i.e.
std::cout

(3) Know there is a difference between compiling C++ code with
gcc or g++/gpp.

Here is a copy of a hello world program I worked on with my 
boy, it compiles and runs successfully.  Compile it with
something like 
gpp hello.cpp

#include <iostream>
using namespace std;

int main(void)
{
  cout << "Goodnight mommy, see you in the morning\n";
  return 0;
}

Wayne

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019