[rhn-users] g++
Naoki
naoki at valuecommerce.com
Mon Sep 26 04:34:35 UTC 2005
Yeah, that one bit me for a while as well. You need to add to the first
one : "using namespace std;" and then it'll know.
On Sun, 2005-09-25 at 22:23 -0600, Craig M. Jameson wrote:
> 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.
>
>
> _______________________________________________
> rhn-users mailing list
> rhn-users at redhat.com
> https://www.redhat.com/mailman/listinfo/rhn-users
More information about the rhn-users
mailing list