[rhn-users] g++

Craig M. Jameson cjarith at comcast.net
Mon Sep 26 04:23:43 UTC 2005


I am befuddled. I am an amateur administrator trying to compile my first
C++ program. (Actually, the compile succeeded.) I tried to compile the
following two programs:

#include <iostream>
#include <stdlib.h>
int main(int argc, char *argv[]) {     cout << "hey"; return 0; }

and

#include <iostream>
#include <stdlib.h>
int main(int argc, char *argv[]) {std::cout << "hey"; return 0; }

The second compiles. The first does not. (Every presumably reliable
source I have seen says to write this as in the first case.) Can I rule
out a problem with my installation? (i.e. is this a problem with my
understanding of linux or C++?)

I compile using the command
   g++ -v filename.C

The output for the first case contains

   #include <...> search starts here:
    /usr/lib/gcc/i386-redhat-linux/3.4.3/../../../../include/c++/3.4.3

where iostream is located, and

   error: `cout' undeclared (first use this function)

(When I compile the second case, in runs fine.)


Craig.





More information about the rhn-users mailing list