iostream compilation problems

B

Bovine

I've recently been using a class for directing output to both a file and
the screen. I copied it from this website:
http://www.talkaboutprogramming.com/group/comp.lang.c++/messages/812299.html
This works perfectly on windows platforms, but for some reason I can't get
it to compile on my SCO machine.
I get the following errors:
tee.h:27: syntax error before `('
tee.h:28: syntax error before `('
tee.h:29: syntax error before `('
and the lines of code this relates to are:
std::streambuf::int_type overflow(std::streambuf::int_type ch);
std::streambuf::int_type underflow();
std::streambuf::int_type sync();

I'm guessing that it doens't like the int_type return type, but I've no
idea why this would be.
If I remove the return type from the first method so it looks like this:
overflow(std::streambuf::int_type ch);
I get the following, slightly move helpful error messages:

tee.h:27: `int_type' is not a member of type `streambuf'
tee.h:27: parse error before `)'
tee.h:27: ANSI C++ forbids declaration `overflow' with no type
tee.h:28: syntax error before `('
tee.h:29: syntax error before `('

Are my libraries out of date and if so how do I find out?
Can anyone help?
For a full list of the code see the URL at the top of this message.

Thanks in advance!
 
D

David Harmon

On Tue, 21 Dec 2004 05:30:47 -0500 in comp.lang.c++, "Bovine"
std::streambuf::int_type overflow(std::streambuf::int_type ch);
std::streambuf::int_type underflow();
std::streambuf::int_type sync();

I'm guessing that it doens't like the int_type return type, but I've no
idea why this would be.

The idea of int_type is that for any given char_type that you are
using you need a corresponding int_type that can contain all of the
values of the char_type plus EOF.

The standard definition of int_type comes eventually from
std::char_traits<char_type> specialized on your particular
char_type, which depends on partial template specialization. Many
earlier C++ compilers did not support partial specialization and
therefore had to use various substandard workarounds instead, with
less than 100% compatibility.

I don't know if that accounts for your problem or not. Have a look
at what your SCO implementation does for the return type of it's
std::streambuf::eek:verflow() etc., and if it is doing something
different that might tell you why the standard thing doesn't work
there. The later message
tee.h:27: `int_type' is not a member of type `streambuf'
suggests that is probably the case.
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top