Hane, Christopher A | 21 May 18:55

date_time giving undefined references

Hello,

I am trying to compile a simple example using the parsers and formatters
of the date_time library using g++ under Cygwin.  I can successfully
build other boost examples passing only the include directory to g++,
but all date_time ones that I have tried fail.

#include <boost/date_time/gregorian/formatters.hpp>
#include <boost/date_time/gregorian/parsers.hpp>
#include <boost/date_time/gregorian/greg_date.hpp>
#include <iostream>

using namespace boost::gregorian;

int main()
{ 
 std::string s("2001-10-9"); //2001-October-09
 date d(from_simple_string(s));
 std::cout << to_simple_string(d) << std::endl;
 }

$g++ -I/usr/include/boost-1_33_1 -o example example.cpp

/cygdrive/c/DOCUME~1/USER/LOCALS~1/Temp/cc2nXx0a.o:example.cpp:(.text$_Z
N5boos
t9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtSs[unsigne
d short
boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std:
:basic_s
tring<char, std::char_traits<char>, std::allocator<char> >)]+0x102):
(Continue reading)

Frank Birbacher | 21 May 23:07

Re: date_time giving undefined references

Hi!

Hane, Christopher A schrieb:
> I can successfully
> build other boost examples passing only the include directory to g++,
> but all date_time ones that I have tried fail.
[snip]
> Any clue what is going wrong here?

Yes. You need more sources. There is a lib/date_time/src... folder 
containing .cpp files which need to be compiled and linked to the 
program. Usually these sources are already compiled and linked into a 
library. But in your case I guess they are not (yet :) )

See the "Getting Started Guide" here 
http://www.boost.org/doc/libs/1_35_0/more/getting_started/index.html

Frank

Gmane