link error: with date_time library

Help
He Ming
2003-01-14
2003-01-14
  • He Ming
    He Ming
    2003-01-14

    I use boost date_time library in my program. And I fall in trouble.
    I can not build my program, there occurs some link errors.

    I'v ran bjam in boost_1_29_0/libs/date_time/build/ , and get a lib file in
    boost_1_29_0/libs/date_time/build/bin/libboost_date_time.a/gcc/debug/ . I copy
    it to my lib directory, and then build my program, the link errors seem less,
    as the list.

    All these occurs on Redhat Linux 7.1, with GCC 2.96. And the makefile is
    generated by Kdevelop 2.0.

    g++ -O0 -g3 -Wall -I/usr/local/include -I/usr/include/mysql -o .libs/mccps argpa
    rse.o main.o  -L/usr/local/lib /usr/local/lib/libsqlplus.so -L/usr/lib/mysql -lz
    -lmysqlclient -lboost_date_time -Wl,--rpath -Wl,/usr/local/lib
    main.o: In function `basic_string<char, string_char_traits<char>, __default_allo
    c_template<true, 0> >::alloc(unsigned int, bool)':
    /usr/include/g++-3/std/bastring.h(.boost::date_time::date<boost::gregorian::date
    , boost::gregorian::gregorian_calendar, boost::date_time::date_duration<long> >:
    :gnu.linkonce.t.year_month_day(void) const+0x15): undefined reference to `boost:
    :date_time::gregorian_calendar_base<boost::date_time::year_month_day_base<boost:
    :gregorian::greg_year, boost::gregorian::greg_month, boost::gregorian::greg_day>
    , unsigned long>::from_day_number(unsigned long)'
    /usr/include/g++-3/std/bastring.h(.boost::date_time::date<boost::gregorian::date
    , boost::gregorian::gregorian_calendar, boost::date_time::date_duration<long> >:
    :gnu.linkonce.t.(boost::date_time::year_month_day_base<boost::gregorian::greg_ye
    ar, boost::gregorian::greg_month, boost::gregorian::greg_day> const &)+0x12): un
    defined reference to `boost::date_time::gregorian_calendar_base<boost::date_time
    ::year_month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month,
    boost::gregorian::greg_day>, unsigned long>::day_number(boost::date_time::year_
    month_day_base<boost::gregorian::greg_year, boost::gregorian::greg_month, boost:
    :gregorian::greg_day> const &)'
    collect2: ld returned 1 exit status
    make: *** [mccps] Error 1

    But my program still can not build. Help me! Thanks.