[ale] basic gcc compiler issues...

Keith Morris graphicsguy at charter.net
Thu Jan 8 08:50:32 EST 2004


After many years away from an elementary knowledge of C and C++ I have
gone back into self training mode, but this is the first time on Linux
and am having a basic compiler problem...

given this program:

#include <iostream.h>

int main() {

  cout << "Hello, World!" << endl;
  return 0;

}
 g++ hello.cpp -o hello compiles correctly, but gives me the following
warning (which I understand):

In file included from /usr/include/c++/3.3.2/backward/iostream.h:31,
                 from hello.cpp:1:
/usr/include/c++/3.3.2/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or antiquated
header. Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard...

so, reading the standard, if I change the program to:

#include <iostream>
...

the compiler gives me this error:
hello.cpp: In function `int main()':
hello.cpp:5: error: `cout' undeclared (first use this function)
hello.cpp:5: error: (Each undeclared identifier is reported only once
for each function it appears in.)
hello.cpp:5: error: `endl' undeclared (first use this function)


I am on Fedora Core 1 and checking the rpm database, all seems to be
installed for C++ console development. Am I missing the standard
libraries?  I can't figure it out. Also, it is doing this on both of the
Fedora machines I have set up.

Thanks for any help you could offer...


-- 
Keith Morris <graphicsguy at charter.net>



More information about the Ale mailing list