Problems using date-time library
Greets all,
I'm in need of using the Date-Time library but I'm encountering a few
issues. I tried compiling the following simple code:
-----------------
#include
I got that too. I tried to fix it by moving the .cpp files from
boost_1_29_0\libs\date_time\src\gregorian to
boost_1_29_0\boost\date_time\gregorian. And it seemed like I also
needed to rename the .ipp file in boost_1_29_0\boost\date_time to be
.cpp. Don't know for sure if it worked because I now get: fatal error
C1063. Too many templates I guess :(
--- In Boost-Users@yahoogroups.com, "Keno"
Greets all,
I'm in need of using the Date-Time library but I'm encountering a few issues. I tried compiling the following simple code:
-----------------
#include
#include <iostream> using namespace boost::gregorian; int main() { date birthday(1979,3,26);
return 0; }
-------------------
and got the following error(s):
--------------------Configuration: boost_date - Win32 Debug-------------------- Compiling... test_date.cpp d:\softdev\vstudio6\vc98\include\new(35) : warning C4290: C++ Exception Specification ignored Linking... test_date.obj : error LNK2001: unresolved external symbol "public: static unsigned long __cdecl boost::date_time::gregorian_calendar_base
,unsigned long>::day_number(struct boost::date_time::year_month_day_base const &)" (?day_number@?$gregorian_ca
lendar_base@U?$year_month_day_base@Vgreg_year@gregorian@boost@@Vgreg_month@2
3@Vgreg_day@23@@date_time@boost@@K@date_time@boost@@SAKABU?$year_month_day_b
ase@Vgreg_year@gregorian@boost@@Vgreg_month@23@Vgreg_day@23@@23@@Z) Debug/boost_date.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe.
boost_date.exe - 2 error(s), 1 warning(s)
-------------------------------
Any clues as to what could be happening here folks?? I'm using MSVC6 with SP5 + STLPort 4.5.3 on WinXP
.: Keno :.
I got that too. I tried to fix it by moving the .cpp files from boost_1_29_0\libs\date_time\src\gregorian to boost_1_29_0\boost\date_time\gregorian. And it seemed like I also needed to rename the .ipp file in boost_1_29_0\boost\date_time to be .cpp. Don't know for sure if it worked because I now get: fatal error C1063. Too many templates I guess :(
Not really. I suggest you restore the code to it's original form. It has been compiled and tested with VC6. The problem is that in your vc project preprocessor settings you need to set the DATE_TIME_INLINE flag. In project settings-> C/C++ ->Preprocessor and add the DATE_TIME_INLINE to the Preprocessor definitions and it should work ok. This is described (perhaps a bit cryptically) in the docs: http://www.boost.org/libs/date_time/doc/BuildInfo.html It was an unfortunate foul-up on my part that users are required to set this in their projects. In the next release this requirement will be removed. HTH, Jeff
I'm in need of using the Date-Time library but I'm encountering a few issues. I tried compiling the following simple code: ... detail omitted...
Looks like you are missing the compile define DATE_TIME_INLINE. See http://www.boost.org/libs/date_time/doc/BuildInfo.html for more. Jeff
Looks like you are missing the compile define DATE_TIME_INLINE.
See http://www.boost.org/libs/date_time/doc/BuildInfo.html for more.
Thanks Jeff! That was it :)
__cdecl boost::date_time::gregorian_calendar_base
,unsigned long>::from_day_number(unsigned long)' f:\libs\boost_1_29_0\boost\date_time\gregorian_calendar.ipp(62) : warning C4244: 'initializing' : conversion from 'unsigned long' to 'unsigned short',
__cdecl boost::date_time::gregorian_calendar_base
,unsigned long>::from_day_number(unsigned long)' f:\libs\boost_1_29_0\boost\date_time\gregorian_calendar.ipp(66) : warning C4244: 'argument' : conversion from 'unsigned long' to 'unsigned short',
Ok Jeff, I hope you can help with this one. Created a date object and did a
call to cout with to_simple_string(0) and got linker errors. Program and
error are below. I looked at the greg_month.hpp file and realised that the
methods complained about are declared but not implemented. Could this be the
source of the problem?
________ CODE & COMPILE ERRORS _____________
#include __cdecl boost::date_time::gregorian_calendar_base boost_date.exe - 3 error(s), 4 warning(s)
Ok Jeff, I hope you can help with this one. Created a date object and did a call to cout with to_simple_string(0) and got linker errors. Program and error are below. I looked at the greg_month.hpp file and realised that the methods complained about are declared but not implemented. Could this be the source of the problem?
Looks like you haven't built and/or included libboost_date_time in your project settings. One problem with the 1.29 release is that the date_time build didn't get into the overall Jamfile so you need to go into the boost/libs/date_time/build library and run bjam to build the library if you haven't already. Once you have the library you will need to also include this in your project settings. And, BTW, the methods are defined in boost/libs/date_time/src/gregorian Jeff
Looks like you haven't built and/or included libboost_date_time in your project settings. One problem with the 1.29 release is that the date_time build didn't get into the overall Jamfile so you need to go into the boost/libs/date_time/build library and run bjam to build the library if you haven't already. Once you have the library you will need to also include this in your project settings. And, BTW, the methods are defined in boost/libs/date_time/src/gregorian
We're in business now Jeff! :) It would definitely be a good thing to have this library included in the boost jam file. Also maybe a bit of mention in the documentation about this library inlcusion would be good too. During my build of the date_time library, I got 3 of the test failing due to a INTERNAL COMPILER ERROR reported by VC. I'll attempt to build again to give you an exact occurence.
participants (3)
-
Jeff Garland
-
Keno
-
Nick Toze <geeky_nick@yahoo.co.uk>