Boost logo

Boost Users :

From: Andre du Toit (adutoit_at_[hidden])
Date: 2003-05-20 15:24:21


Hi there.

I get the following error when I try to compile code using
boost::date_time::posix_time:

c:\PROGRAM
FILES\BOOST_1_30_0\boost/date_time/posix_time/time_formatters.hpp(43):
error: more than one operator "<<" matches these operands:
            function "std::basic_ostream<_E,
_Tr>::operator<<(std::_Bool={bool={bool}}) [with _E=char,
_Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(short)
[with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(unsigned
short) [with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(int) [with
_E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(unsigned
int) [with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(long)
[with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(unsigned
long) [with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(float)
[with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(double)
[with _E=char, _Tr=std::char_traits<char>]"
            function "std::basic_ostream<_E, _Tr>::operator<<(long
double) [with _E=char, _Tr=std::char_traits<char>]"
            operand types are: std::basic_ostream<char,
std::char_traits<char>> <<
boost::posix_time::time_duration::fractional_seconds_type
          << frac_sec;

Looking at the offending file (time_formatters.hpp, line 43 and
vicinity) gives:

#if (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0
    boost::int64_t frac_sec = td.fractional_seconds();
// JDG [7/6/02 VC++ compatibility]
    char buff[32];
    _i64toa(frac_sec, buff, 10);
#else
    time_duration::fractional_seconds_type frac_sec =
td.fractional_seconds();
#endif

    if (frac_sec != 0) {
      ss << "." << std::setw(time_duration::num_fractional_digits())
          << std::setfill('0')

// JDG [7/6/02 VC++ compatibility]
#if (defined(BOOST_MSVC) && (_MSC_VER <= 1200)) // 1200 == VC++ 6.0
        << buff;
#else
        << frac_sec; //!!! Line 43 !!!//
#endif

It appears that there is not a streaming operator defined for the
time_duration::fractional_seconds_type type. Looking deeper into this
issue was a bit of nightmare; since the offending type consists of
numerous nested typdefs etc. etc.

If anyone has a short and sweet answer to my essay of a question, I
would appreciate it. The obvious answer of "don't use the Intel
compiler" will not suffice! Saying that, when I switched from the Intel
compiler to bad old MSVC6 I had not problems. But our company's
software requires the performance gain provided by the Intel compiler on
Windows.

Another issue, I saw that during installation of Boost, it is possible
using STLPort and MSVC6 together, but (for the reasons mentioned above),
why not STLPort with the Intel compiler?

I did ask the same question some time before now, but no-one bothered to
answer.

I would really appreciate any help in this regard!

Greetings,
Andre.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net