Problem while including iostream.h in files targetted by ns2.26 make

P

Pradyot Dhulipala

Hi,
I am using ns2.26 with the Makefile using C++ compiler version c++
(GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk).
When I use iostream.h in a simple program and compile with c++
everything works except I get a deprecated warning.
Using the find command I get the location of iostream.h as
/usr/include/c++/3.2.2/iostream.
Also in my makefile the list of includes are as follows

INCLUDES = \
-I. \
-I/home/pradyot/ns-allinone-2.26/tclcl-1.0b13
-I/home/pradyot/ns-allinone-2.26/otcl-1.0a8
-I/home/pradyot/ns-allinone-2.26/include
-I/home/pradyot/ns-allinone-2.26/include -I/usr/include/pcap \
-I./tcp -I./common -I./link -I./queue \
-I./adc -I./apps -I./mac -I./mobile -I./trace \
-I./routing -I./tools -I./classifier -I./mcast \
-I./diffusion3/lib/main -I./diffusion3/lib \
-I./diffusion3/lib/nr -I./diffusion3/ns \
-I./diffusion3/diffusion -I./asim/ -I./qs \
-I/usr/include/c++/3.2.2 -I/usr/include/c++/3.2.2/backward \
-I/usr/include/c++/3.2.2/bits

The problem I have is that I can't seem to include iostream.h in my
project files targeted by ns make without getting a whole string of
error messages too lengthy to produce but the gist is as follows.
In file included from /usr/include/c++/3.2.2/string:57,
from /usr/include/c++/3.2.2/bits/localefwd.h:49,
from /usr/include/c++/3.2.2/ios:48,
from /usr/include/c++/3.2.2/ostream:45,
from /usr/include/c++/3.2.2/iostream:45,
from /usr/include/c++/3.2.2/backward/iostream.h:32,
/usr/include/c++/3.2.2/bits/basic_string.tcc: In
member function `_Alloc::size_type std::basic_string<_CharT, _Traits,
_Alloc>::rfind(const _CharT*, _Alloc::size_type, _Alloc::size_type)
const':
/usr/include/c++/3.2.2/bits/basic_string.tcc:712: parse error before
`(' token
In file included from
/usr/include/c++/3.2.2/bits/locale_facets.tcc:43,
from /usr/include/c++/3.2.2/locale:46,
from /usr/include/c++/3.2.2/bits/ostream.tcc:37,
from /usr/include/c++/3.2.2/ostream:275,
from /usr/include/c++/3.2.2/iostream:45,
from /usr/include/c++/3.2.2/backward/iostream.h:32,
/usr/include/c++/3.2.2/limits:942:22: macro "min"
requires 2 arguments, but only 1 given
In file included from
/usr/include/c++/3.2.2/bits/locale_facets.tcc:43,
from /usr/include/c++/3.2.2/locale:46,
from /usr/include/c++/3.2.2/bits/ostream.tcc:37,
from /usr/include/c++/3.2.2/ostream:275,
from /usr/include/c++/3.2.2/iostream:45,
from /usr/include/c++/3.2.2/backward/iostream.h:32,
/usr/include/c++/3.2.2/limits: At global scope:
/usr/include/c++/3.2.2/limits:942: parse error before `throw'
/usr/include/c++/3.2.2/limits:943:22: macro "max" requires 2
arguments, but only 1 given
This is followed by a whole bunch of errors in limits.

If anyone can suggest a soln I would be most grateful.
Thanks,
Pradyot
 
J

John Harrison

Pradyot Dhulipala said:
Hi,
I am using ns2.26 with the Makefile using C++ compiler version c++
(GCC) 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk).
When I use iostream.h in a simple program and compile with c++
everything works except I get a deprecated warning.
Using the find command I get the location of iostream.h as
/usr/include/c++/3.2.2/iostream.
Also in my makefile the list of includes are as follows
[snip]


If anyone can suggest a soln I would be most grateful.
Thanks,
Pradyot

Yes use <iostream> not <iostream.h>. Despite what your error message say
<iostream.h> is not and never has been a standard C++ header file, it is not
deprecated, it is plain wrong, use <iostream> instead.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top