ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] date_time linker problems/errors
by Christian Körber other posts by this author
Sep 19 2003 10:12AM messages near this date
[boost] Re: Library proposal --- pair (and tuple) iterators | [boost] Re: date_time linker problems/errors
Hi,

I have encountered linking problems with the date_time
library which I cannot resolve myself.

Other libraries like shared_ptr work fine, though.


I use VC7 (.NET 2002)


Here's what I did:

1. downloaded and installed boost the complete 1.30.2

2. added boost to the include path

3. in the jamfile I commented the line
   local DATE_TIME_PROPERTIES =
<define> BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG ;
   in order to enable the 64-bit integer only implementation.

   Here I encountered the first problem: In the jamfile
   (included at the end of this mail) it says not only
   to comment this line but also to "out comment" a line
   "above". I could not identify such a line.

4. invoked bjam to build all boost libraries including
   date_time by bjam "-sTOOLS=msvc". I later tried
   bjam "-sTOOLS=vc7" which probably did the same as
   I have only VC7 installed (and not VC6 too).

5. I added
   boost-1.30.2\libs\date_time\build\bin   libboost_date_time.lib\msvc\debug\runtime-link-dy
namic   libboost_date_time.lib
   as an input libryry to the linker (project properties).

6. I tried to build one of the sample programs, short
   version here, complete one at the end of this mail.

   #include "boost/date_time/posix_time/posix_time.hpp"
   #include <iostream> 

   int main()
   {
      using namespace boost::posix_time;
      using namespace boost::gregorian;

      date d(2002,Feb,1); //an arbitrary date
      //construct a time by adding up some durations durations
      ptime t1(d, hours(5)+minutes(4)+seconds(2)+millisec(1));

      std::cout << to_simple_string(t1);

      return 0;
    }

   This resulted in several warnings, mostly due to the
   conversion of larger intagral types to smaller one
   (possible loss of data) and the following linker
   errors(edited):

   A:
   error LNK2005: "private: __thiscall type_info::type_info(
   class type_info const &)" (??0type_info@@AAE@ABV0@@Z)
   already defined in LIBCD.lib(typinfo.obj)

   B:
   error LNK2005: "private: class type_info & __thiscall
   type_info::operator=(class type_info const &)"
   (??4type_info@@AAEAAV0@ABV0@@Z)
   already defined in LIBCD.lib(typinfo.obj)

   C:
   warning LNK4098: defaultlib 'MSVCRTD' conflicts with
   use of other libs; use /NODEFAULTLIB:library

   D:
   fatal error LNK1169: one or more multiply defined symbols
   found



   This means to me that some functions of type_info are
   both defined in the stdlib of VC7 and somewhere in
   boost.
   I have no idea about how to resolve this issue. I tried
   to link with /NODEFAULTLIB but this gave me much much
   more linker errors than I had before.


   Any suggestion are highly appreciated,

   Christian Koerber





JAMFILE START

#  (C) Copyright  2002. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice
appears
#  in all copies. This software is provided "as is" without express or
implied
#  warranty, and with no claim as to its suitability for any purpose.
#
#
# Boost.date_time build
#
# To run all tests quietly: jam test
#
# Declares the following targets:
#   1. libboost_date_time, a library to be linked with all
#      Boost.date_time modules
#

# declare the location of this subproject relative to the root
subproject libs/date_time/build ;

# comment the line below and comment out the line above to change to
# 64 bit counted time implementation

local DATE_TIME_PROPERTIES = <define> BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG ;


# Base names of the source files for libboost_date_time
CPP_SOURCES =
    greg_month greg_weekday ;

dll boost_date_time : ../src/gregorian/$(CPP_SOURCES).cpp
    : <sysinclude> $(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
    : debug release
    ;

lib boost_date_time : ../src/gregorian/$(CPP_SOURCES).cpp
    : <sysinclude> $(BOOST_ROOT) $(DATE_TIME_PROPERTIES)
    : debug release
    ;

JAMFILE END



ORIGINAL SAMPLE PROGRAM START

   #include "boost/date_time/posix_time/posix_time.hpp"
   #include <iostream> 

   int main()
   {
      using namespace boost::posix_time;
      using namespace boost::gregorian;

      date d(2002,Feb,1); //an arbitrary date
      //construct a time by adding up some durations durations
      ptime t1(d, hours(5)+minutes(4)+seconds(2)+millisec(1));
      //construct a new time by subtracting some times
      ptime t2 = t1 - hours(5)- minutes(4)- seconds(2)- millisec(1);
      //construct a duration by taking the difference between times
      time_duration td = t2 - t1;

      std::cout << to_simple_string(t2) << " - "
         << to_simple_string(t1) << " = "
         << to_simple_string(td) << std::endl;

      return 0;
    }

ORIGINAL SAMPLE PROGRAM END



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Christian Körber
Christian Körber
Christian Körber
John Maddock

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved