Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-12-11 09:39:00


Delvaille Florent wrote:
> Hi, I ve a problem with ptime.
> I'm doing a a project on Eclipse, and I need to create a ptime object
> from a string. Here's my code:
>
> std::string ts("2002-01-20 23:59:59.000");
> ptime t(time_from_string(ts))
>
> This code is exactly the same in the boost documentation.
>
> On compilation, no error is detected.
> But there's a problem with the linker.
>
> I paste here the error that Eclipse gives to me:
>
> Invoking: GCC C++ Linker
> g++ -o"brol" ./initmain.o
> ./initmain.o: dans la fonction « unsigned short
> boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::basic_string<char,
> std::char_traits<char>, std::allocator<char> >)»:
> /usr/include/boost/date_time/date_parsing.hpp:67: référence indéfinie
> vers « boost::gregorian::greg_month::get_month_map_ptr() »
> collect2: ld returned 1 exit status
>
> Do you have an idea?

Yep, you'll need to build and link libboost_datetime to get for this function.
  Assuming you're using 1.33 you can get the same functionality using the
time_facet and a string stream and then you won't need to link the library.
See the docs for details on how to use the time_facet if you choose to go that
way.

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