Date: Mon, 21 Apr 2003 05:39:11 -0400 From: Jason Griffis <jgriffis@ec.rr.com> To: freebsd-questions@freebsd.org Subject: g++ question Message-ID: <200304210539.11227.jgriffis@ec.rr.com>
next in thread | raw e-mail | index | archive | help
=09I'm going through a C++ tutorial trying to increase my knowledge ;) Any way.. I wrote this little code: // My first program in C++ #include <iostream> int main() { =09cout << "Hello World!"; =09return 0; } =09When I compile it this way with g++ I get errors due to the compiler n= ot=20 finding the iostream file: $ g++ -o hello hello.cc hello.cc: In function `int main()': hello.cc:6: `cout' undeclared (first use this function) hello.cc:6: (Each undeclared identifier is reported only once for each=20 function it appears in.) $ =09I do have iostream in /usr/include so I don't see why it's doing this,= =20 whenever I change it to #include <iostream.h> it compiles fine but gives = a=20 warning of using a deprecated header file: $ g++ -o hello hello.cc In file included from /usr/include/g++/backward/iostream.h:31, from hello.cc:2: /usr/include/g++/backward/backward_warning.h:32:2: warning: #warning This= file=20 includes at least one deprecated or antiquated header. Please consider us= ing=20 one of the 32 headers found in section 17.4.1.2 of the C++ standard. Exam= ples=20 include substituting the <X> header for the <X.h> header for C++ includes= , or=20 <sstream> instead of the deprecated header <strstream.h>. To disable this= =20 warning use -Wno-deprecated. $ =09Obviously it isn't that big of a deal with such a small program but wh= en I=20 move on to bigger projects that I'll want to use on different platforms o= ther=20 than FreeBSD these errors and warnings will be a major pain. Can anyone t= ell=20 me what might be wrong with my system in order for g++ not to see the nor= mal=20 iostream header in /usr/include ?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304210539.11227.jgriffis>