|
Boost Users : |
From: Stephen Love (snl_at_[hidden])
Date: 2003-02-25 09:48:24
Tuesday, February 25, 2003, 1:15:10 PM, you wrote:
EC> I'm trying to test the date_time functionality of boost and am having some
EC> difficulties. I would like to simply get the current local time into a ptime
EC> and write it out as an ISO-8601 string.
EC> Using Boost 1.29 and g++ 3.2, when I compile the following code I get a
EC> number of *linker* errors.
EC> Code:
EC> #include <boost/date_time/posix_time/posix_time_types.hpp>
EC> #include <boost/date_time/posix_time/time_formatters.hpp>
EC> int main()
EC> {
EC> boost::posix_time::ptime pt = boost::posix_time::second_clock::local_time();
EC> std::cout << boost::posix_time::to_iso_extended_string(pt) << std::endl;
EC> }
EC> That code seems pretty straightforward to me. The linker errors look like
EC> the following:
EC> test.cpp:7: undefined reference to
EC> `boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost::gregorian::greg_year,
EC> boost::gregorian::greg_month, boost::gregorian::greg_day>, unsigned
long>>::day_number(boost::date_time::year_month_day_base<boost::gregorian::greg_year,
EC> boost::gregorian::greg_month, boost::gregorian::greg_day> const&)'
EC> test.cpp:6: undefined reference to
EC> `boost::date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost::gregorian::greg_year,
EC> boost::gregorian::greg_month, boost::gregorian::greg_day>, unsigned
long>>::from_day_number(unsigned long)'
EC> (snipped...)
EC> Best as I can tell (cd $BOOST_ROOT/boost/date_time && find . -name '*.cpp'
EC> -print), there are no .cpp files to be compiled...
EC> Anyone know what's up?
EC> --Eric
EC> _________________________________________________________________
EC> Protect your PC - get McAfee.com VirusScan Online
EC> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Tuesday, February 25, 2003, 1:15:10 PM, you wrote:
EC> I'm trying to test the date_time functionality of boost and am having some
EC> difficulties. I would like to simply get the current local time into a ptime
EC> and write it out as an ISO-8601 string.
EC> Using Boost 1.29 and g++ 3.2, when I compile the following code I get a
EC> number of *linker* errors.
EC> Code:
EC> #include <boost/date_time/posix_time/posix_time_types.hpp>
EC> #include <boost/date_time/posix_time/time_formatters.hpp>
You need to include
<boost/date_time/posix_time/posix_time.hpp>
**Note - no _types at the end)
to bring in the I/O stuff for dates and times. The same would go for
just dates (gregorian.hpp instead of gregorian_types.hpp)
HTH
Steve
-- Steve Love: steve.love_at_[hidden] ACCU - accu.org Promoting Professionalism in Programming
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net