Thanks for your response. I get the same results whatever I try, including with testgreg_wstream.cpp. The only way I've been able to get my code working is to define BOOST_DATE_TIME_NO_WSTRING_CONVERSIONS, and then convert to wchar_t myself. I'm pretty sure my CVS files are up to date, but here's a directory listing (in dd/mm/yyyy format), just in case: 18/02/2004 17:49 5,731 formatters.hpp 15/02/2004 16:17 2,845 formatters_limited.hpp 18/02/2004 17:49 1,006 gregorian.hpp 02/12/2003 15:14 3,107 gregorian_types.hpp 02/12/2003 15:14 1,572 greg_calendar.hpp 12/01/2004 16:42 3,824 greg_date.hpp 02/12/2003 15:14 1,826 greg_day.hpp 02/12/2003 15:14 1,078 greg_day_of_year.hpp 02/12/2003 15:14 922 greg_duration.hpp 01/03/2004 16:58 8,288 greg_facet.hpp 18/02/2004 17:49 2,911 greg_month.hpp 18/02/2004 17:49 1,897 greg_weekday.hpp 02/12/2003 15:14 1,648 greg_year.hpp 02/12/2003 15:14 904 greg_ymd.hpp 01/03/2004 16:58 3,195 parsers.hpp - Keith MacDonald "Jeff Garland" <jeff@crystalclearsoftware.com> wrote in message news:20040314143154.M74344@crystalclearsoftware.com...
On Sun, 14 Mar 2004 12:27:55 -0000, Keith MacDonald wrote
I'm trying to convert a gregorian::date to a string, as shown in the following code:
// Build: cl /EHsc /I \CVS\boost dt.cpp #include <iostream> #include <boost/date_time/gregorian/gregorian.hpp> int main() { boost::gregorian::date today(2004, boost::gregorian::Mar, 14);
std::cout << today << std::endl; return 0; }
This definately should work. What happens if you do std::cout << to_simple_string(today) << std::endl; or std::wcout << to_simple_wstring(today) << std::endl;
When I compile it with Visual C++ 7.1, using Boost from CVS head,
Are you positive about this? Changes to support wide streaming went in a couple weeks back. Seems like maybe you don't have all of that change.
I get the following error:
\CVS\boost\boost\lexical_cast.hpp(150) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'boost::date_time::date_formatter <date_type,format_type,charT>::string_type' (or there is no acceptable conversion) with [ date_type=boost::gregorian::date, format_type=boost::date_time::simple_format, charT=wchar_t ]
The same thing happens when using to_simple_string and to_simple_string_type<char>, rather than operator<<. I actually want the result as a basic_string<wchar_t>, but all variations produce this same error. What am I doing wrong?
I really don't know. Can you try running the regression tests in your environment? In particular I'm interested in
libs/date_time/test/gregorian/testgreg_wstream.cpp
Anyway, judging from the regression tests this should be working for you...
Jeff