date_time link or compile problem

I have boost 1.29 and gcc 3.2.2 on Linux. Here is the simple code I am trying to compile: #include <string> #include "boost/date_time/gregorian/gregorian.hpp" int main() { using namespace std; using namespace boost::gregorian; string ds("2002/1/25"); date d1(from_string(ds)); return 0; } I get the following link error: make g++ main.cc -lstdc++ -o test /tmp/ccph1inq.o(.gnu.linkonce.t._ZN5boost9date_time4dateINS_9gregorian4dateENS2_18gregorian_calendarENS0_13date_durationIlEEEC2ERKNS0_19year_month_day_baseINS2_9greg_yearENS2_10greg_monthENS2_8greg_dayEEE+0x11): In function `boost::date_time::date<boost::gregorian::date, boost::gregorian::gregorian_calendar, boost::date_time::date_duration<long> >::date[not-in-charge](boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day> const&)': : undefined reference to `boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day>, unsigned long>::day_number(boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day> const&)' collect2: ld returned 1 exit status make: *** [test] Error 1 The missing symbol does not seem to be in the static library libboost_date_time.a, so I don't think I need to link to that. Any suggestions? Thanks in advance, Jimmy.

There is a link error in 1.29.0 that is solved by #define BOOST_DATE_TIME_INLINE before including the date_time headers. It has been changed in 1.30.0 so this define isn't needed. HTH Russell Jimmy Pritts wrote:
I have boost 1.29 and gcc 3.2.2 on Linux. Here is the simple code I am trying to compile:
#include <string> #include "boost/date_time/gregorian/gregorian.hpp"
int main() { using namespace std; using namespace boost::gregorian;
string ds("2002/1/25"); date d1(from_string(ds));
return 0; }
I get the following link error:
make g++ main.cc -lstdc++ -o test /tmp/ccph1inq.o(.gnu.linkonce.t._ZN5boost9date_time4dateINS_9gregorian4dateENS2_18gregorian_calendarENS0_13date_durationIlEEEC2ERKNS0_19year_month_day_baseINS2_9greg_yearENS2_10greg_monthENS2_8greg_dayEEE+0x11): In function `boost::date_time::date<boost::gregorian::date, boost::gregorian::gregorian_calendar, boost::date_time::date_duration<long> >::date[not-in-charge](boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day> const&)': : undefined reference to `boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day>, unsigned long>::day_number(boost::date_time::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day> const&)' collect2: ld returned 1 exit status make: *** [test] Error 1
The missing symbol does not seem to be in the static library libboost_date_time.a, so I don't think I need to link to that. Any suggestions?
Thanks in advance, Jimmy.
Info: <http://www.boost.org> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@yahoogroups.com>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
participants (2)
-
Jimmy Pritts
-
Russell Hind