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>
index | next in thread | raw e-mail
I'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()
{
cout << "Hello World!";
return 0;
}
When I compile it this way with g++ I get errors due to the compiler not
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
function
it appears in.)
$
I do have iostream in /usr/include so I don't see why it's doing this,
whenever I change it to #include <iostream.h> it compiles fine but gives a
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
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. Examples
include substituting the <X> header for the <X.h> header for C++ includes, or
<sstream> instead of the deprecated header <strstream.h>. To disable this
warning use -Wno-deprecated.
$
Obviously it isn't that big of a deal with such a small program but when I
move on to bigger projects that I'll want to use on different platforms other
than FreeBSD these errors and warnings will be a major pain. Can anyone tell
me what might be wrong with my system in order for g++ not to see the normal
iostream header in /usr/include ?
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304210539.11227.jgriffis>
