Mail Archives: djgpp/2003/01/02/09:42:14
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 -