Compile error of data_time

boost-users: Here is a new user's letter for help: when i compile the whole boost(version_1_32_0), it show some error of data_time. the file greg_month.cpp failed. in the lexical_cast.hpp,line 126 string_type s(boost::lexical_cast<string_type>("not-a-date-time")); the compiler said : binary '>>' : no operator found which takes a right-hand operand of type_put<Config,charT,OutputIterator>::string_type' (or there is no acceptable conversion) When tracing down the error message, I found that [[date_names_put::string_type]] actually means [[std::basic_string<charT>]] and in file lexical_cast.hpp line 146 -- 168 there are right overload of operator>>. Why the compiler complain about can't find the wellformed operator? My Compiler is msvc71 and STLport-5.0-0125 was installed with it's own iostream. the cmdline is bjam "-sVC71_ROOT=D:\Program Files\Microsoft\Microsoft Visual Studio .NET 2003\Vc7" "-sSTLPORT_PATH=D:\Program Files\Programming_Tools\STLport-5.0-0125\stlport" "-sSTLPORT_5.0-0125_PATH=D:\Program Files\Programming_Tools\STLport-5.0-0125" "-sSTLPORT_VERSIONS=5.0-0125" "-sTOOLS=vc-7_1-stlport" "--prefix=D:\Program Files\Programming_Tools\Boost_1_32" install --with-date_time this problem has killed so many brain cells of mine ! zhengyi goodmen@x263.net 2004-12-08

On Wed, 8 Dec 2004 14:56:5 +0800, zhengyi wrote
boost-users: Here is a new user's letter for help:
when i compile the whole boost(version_1_32_0), it show some error of data_time.
the file greg_month.cpp failed. in the lexical_cast.hpp£¬line 126 string_type s(boost::lexical_cast<string_type>("not-a- date-time"));
the compiler said : binary '>>' : no operator found which takes a right-hand operand of type_put<Config,charT,OutputIterator>::string_type' (or there is no acceptable conversion)
When tracing down the error message, I found that [[date_names_put::string_type]] actually means [[std::basic_string<charT>]] and in file lexical_cast.hpp line 146 -- 168 there are right overload of operator>>. Why the compiler complain about can't find the wellformed operator?
I believe this to be related to STLport and it's support for wchar_t somehow. My only real suggestion is to play with the configuration. One thing you can try is to set BOOST_NO_STD_WSTRING when you try to compile date-time. That will make sure that date-time doesn't try to use wchar_t. A bit more drastic would be to set BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS. See boost/date_time/compiler_config.hpp. There you will see that under certain conditions we set that // workaround for errors associated with output for date classes // modifications and input streaming for time classes. // Compilers affected are: // gcc295, msvc (neither with STLPort), any borland // #if (((defined(__GNUC__) && (__GNUC__ < 3)) || \ (defined(_MSC_VER) && (_MSC_VER <= 1200)) ) && \ !defined(_STLP_OWN_IOSTREAMS) ) || \ defined(__BORLANDC__) #define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS #endif It's possible there are times with STLPort that this needs to be set.
My Compiler is msvc71 and STLport-5.0-0125 was installed with it's own iostream.
the cmdline is
bjam "-sVC71_ROOT=D:\Program Files\Microsoft\Microsoft Visual Studio .NET 2003\Vc7" "-sSTLPORT_PATH=D:\Program Files\Programming_Tools\STLport-5.0-0125\stlport" "-sSTLPORT_5.0- 0125_PATH=D:\Program Files\Programming_Tools\STLport-5.0-0125" "- sSTLPORT_VERSIONS=5.0-0125" "-sTOOLS=vc-7_1-stlport" "- -prefix=D:\Program Files\Programming_Tools\Boost_1_32" install - -with-date_time
this problem has killed so many brain cells of mine !
Sorry to hear that :-( Jeff

Hello, I had a very similar problem. I tried to build date_time of Boost 1.32.0 without native-wchar_t support of the Microsoft Visual C++ 7.1 Compiler. Here is the bjam command line: bjam -sTOOLS=vc-7_1 "-sBUILD=debug <native-wchar_t>off" --with-date_time The build results show the following error: D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\boost\lexical_cast.hpp(150) : error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'boost::date_time::date_names_put<Config,charT,OutputIterator>::string_type' (or there is no acceptable conversion) with [ Config=boost::gregorian::greg_facet_config, charT=wchar_t, OutputIterator=std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>> ] D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\boost\lexical_cast.hpp(189) : see reference to function template instantiation 'bool boost::detail::lexical_stream<Target,Source>::operator >><Target>(InputStreamable &)' being compiled with [ Target=boost::date_time::date_names_put<boost::gregorian::greg_facet_config,wchar_t,std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>>>::string_type, Source=const char *, InputStreamable=boost::date_time::date_names_put<boost::gregorian::greg_facet_config,wchar_t,std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>>>::string_type ] D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\boost\date_time\date_names_put.hpp(126) : see reference to function template instantiation 'Target boost::lexical_cast<boost::date_time::date_names_put<Config,charT,OutputIterator>::string_type,const char*>(Source)' being compiled with [ Target=boost::date_time::date_names_put<boost::gregorian::greg_facet_config,wchar_t,std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>>>::string_type, Config=boost::gregorian::greg_facet_config, charT=wchar_t, OutputIterator=std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>>, Source=const char * ] D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\boost\date_time\date_names_put.hpp(122) : while compiling class-template member function 'void boost::date_time::date_names_put<Config,charT,OutputIterator>::do_put_special_value(boost::date_time::date_names_put<Config,charT,OutputIterator>::iter_type &,boost::date_time::date_names_put<Config,charT,OutputIterator>::special_value_enum) const' with [ Config=boost::gregorian::greg_facet_config, charT=wchar_t, OutputIterator=std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>> ] D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\boost\date_time\date_names_put.hpp(208) : see reference to class template instantiation 'boost::date_time::date_names_put<Config,charT,OutputIterator>' being compiled with [ Config=boost::gregorian::greg_facet_config, charT=wchar_t, OutputIterator=std::ostreambuf_iterator<wchar_t,std::char_traits<wchar_t>> ] D:\Projects\3rdParty\Boost\Boost_1_32_0\Temp\boost_1_32_0\libs\date_time\build\../src\gregorian\greg_month.cpp(129) : see reference to class template instantiation 'boost::date_time::all_date_names_put<Config,charT>' being compiled with [ Config=boost::gregorian::greg_facet_config, charT=wchar_t ] The build with enabled native wchar_t support succeeds. I have compared the two Toolset files vc-7_1-tools.jam and vc-7_1-stlport-tools.jam. Although I'm not very familiar with jam files, I think that the native wchar_t support of the Visual C++ compiler is disabled per default in the vc-7_1-stlport Toolset. vc-7_1-tools.jam: ... feature native-wchar_t : on off ; ... vc-7_1-stlport-tools.jam: ... feature native-wchar_t : off on ; ... If I set the BOOST_NO_STD_WSTRING macro - like Jeff suggest - the build without native wchar_t support succeeds. Regards, Jochen.
participants (3)
-
Jeff Garland
-
Jochen Hammann
-
zhengyi