Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2005-12-23 11:02:07


On Fri, 23 Dec 2005 08:13:48 +0100, Oliver.Kowalke wrote
> Hi,
> I get an linker message if I compile my app with gcc-3.4.2 on Linux and
> link it against date_time library of boost 1.33.1:
>
> /usr/lib/gcc-lib/i586-suse-linux/3.3.1/../../../../i586-suse-linux/bin/l
>
> d: `.L1966' referenced in section `.rodata' of .libs/oci_date.o: defined
> in discarded section
> `.gnu.linkonce.t._ZN5boost9date_time23gregorian_calendar_baseINS0_19year
> _month_day_baseINS_9gregorian9greg_yearENS3_10greg_monthENS3_8greg_dayEE
> EmE16end_of_month_dayES4_S5_' of .libs/oci_date.o
>
> I only instantiate an ptime and call time_from_string and
> to_iso_extended_string.
>
> What is going wrong?

Are you including the library in your linking? Normally looks something like:

g++ -otest.exe test.o -L
PATH_TO_BOOST/bin/boost/libs/date_time/build/libboost_date_time.a/gcc/debug -l
boost_date_time-gcc-d-1_33

The other option is to avoid to_*_string and the *_from_string functions.
These require the library. You can rewrite your code and go header only with
operators << and >>. For example:

  ptime t;
  std::stringstream is("2005-Dec-23 00:00:00.123");
  is >> t;
  time_facet* of = new time_facet();
  of->set_iso_extended_format();
  std::cout.imbue(std::locale(std::locale::classic(), of));
  std::cout << t << std::endl; //prints 2005-12-23 00:00:00.123000

Jeff


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