Opened 19 years ago

Closed 19 years ago

#254 closed Bugs (Invalid)

time_from_string link problem

Reported by: nobody Owned by: az_sw_dude
Milestone: Component: date_time
Version: None Severity:
Keywords: Cc:

Description

I'm using libboost-date-time1.31.0 
I have a link error when trying this code example : 
 
std::string ts("2002-01-20 23:59:59.000");  
boost::posix_time::ptime 
t(boost::posix_time::time_from_string(ts)); 
 
Linking prog ... 
database.o(.gnu.linkonce.t._ZN5boost9date_time19month_str_to_ushortINS_9gregorian10greg_monthEEEtSs+0x119): 
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> >)»: 
: undefined reference to 
`boost::gregorian::greg_month::get_month_map_ptr()' 
collect2: ld a retourné 1 code d'état d'exécution 
 
 
source : 
http://www.boost.org/libs/date_time/doc/class_ptime.html 
 
ptime time_from_string(const std::string&) 
From delimited string. 
 
    std::string ts("2002-01-20 23:59:59.000");  
    ptime t(time_from_string(ts)) 
 
 
 
thank you 
 
al_x7@hotmail.com 

Change History (3)

comment:1 by az_sw_dude, 19 years ago

Logged In: YES 
user_id=579686

I suspect you are not linking against the library.  With g++
this would look like:

g++ -I $(BOOST_ROOT) my_date_code.cpp  -L . -l
boost_date_time-gcc-s-1_31 

where you have libboost_date_time-gcc-s-1_31.a in the local
directory.  Of course you need to build the library first if
you haven't already.  See documentation for instructions.


comment:2 by andrasiel, 19 years ago

Logged In: YES 
user_id=1021845

I apologize; there is no bug my linking option was incomplete... 
very sorry 

comment:3 by az_sw_dude, 19 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.