Boost logo

Boost :

From: Jens Seidel (jensseidel_at_[hidden])
Date: 2007-10-30 18:15:40


On Tue, Oct 30, 2007 at 07:18:57PM +0200, John Torjo wrote:
> Jens Seidel wrote:
> > I attached another patch which allows now to properly compile at least
> > each header file (independently) of Boost.Log.
>
> ===================================================================
> --- boost/logging/format/formatter/defaults.hpp (Revision 40606)
> +++ boost/logging/format/formatter/defaults.hpp (Arbeitskopie)
> @@ -24,6 +24,7 @@
> #include <boost/logging/detail/fwd.hpp>
> #include <boost/logging/detail/manipulator.hpp>
> #include <boost/logging/format/formatter/time.hpp>
> +#include <sstream> // std::basic_ostringstream
> #include <stdio.h>
>
>
> Why use <sstream> ? I tried to minimize dependencies. In defaults.hpp there's no need for basic_ostringstream.

You're wrong, it is required! I tested with both a recent 4.x gcc
version (don't remember what version I used in the last test) and
3.4. (Didn't you see my comment std::basic_ostringstream? Search for
this and you will find at least one match in the file!)

Try the following program:

#include <boost/logging/format/formatter/defaults.hpp>

int main()
{
  return 0;
}

You get without the fix:

g++-3.4 -I. -I Boost/svn/trunk/ -Wall -pedantic -Wcast-align -Wpointer-arith -W main.cpp -o all
In file included from main.cpp:3:
boost/logging/format/formatter/defaults.hpp: In member function `void boost::logging::formatter::idx_t<convert>::operator()(msg_type&) const':
boost/logging/format/formatter/defaults.hpp|60| error: no match for 'operator<<' in 'idx << (const boost::logging::char_type*)(boost::logging::ansi_unicode_char_holder("[", "[\000\000\000\000\000\000"))'
boost/logging/format/formatter/defaults.hpp|62| error: invalid use of undefined type `struct std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'
/usr/include/c++/3.4/iosfwd|80| error: declaration of `struct std::basic_ostringstream<char, std::char_traits<char>, std::allocator<char> >'

I added also all other errors I get without further includes in the
patch to convict you. Please apply the patch (without the comments) it
is really save :-)

Jens




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk