2

我正在尝试构建 Boost date_time 库,以便可以将其链接到我的 Makefile 中。我在“libs/date_time/build”中看到一个孤独的“Jamfile.v2”,如果我输入 jam,我会得到:

Jamfile: No such file or directory
...found 7 target(s)...

我现在不知道该怎么做,在 Boost 文档中找不到有关 date_time 安装的任何信息。

以下是文档中的文字:

# Boost.date_time build and test Jamfile
#
#  Based on boost.python Jamfile
#
# To run all tests quietly: jam test
#
# Declares the following targets:
#   1. libboost_date_time, a static link library to be linked with all
#      Boost.date_time modules
#


project boost/date_time
    : requirements
        <define>DATE_TIME_INLINE
    <link>shared:<define>BOOST_ALL_DYN_LINK=1   
    <link>static:<define>BOOST_DATE_TIME_STATIC_LINK    
    : usage-requirements    
        <define>DATE_TIME_INLINE
        <link>shared:<define>BOOST_DATE_TIME_DYN_LINK=1
    : source-location ../src
    ;

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

lib boost_date_time : gregorian/$(CPP_SOURCES).cpp ;

boost-install boost_date_time ;

谢谢,乔

4

2 回答 2

0

没关系,我刚刚找到了文档: http: //www.boost.org/doc/libs/1_52_0/more/getting_started/unix-variants.html

显然没有必要为日期时间构建任何东西。仍然有一些问题,但这将是一个不同的问题。

于 2012-12-26T18:26:22.370 回答
0

只是为了帮助其他尝试使用 date_time 库的人。您不需要构建任何东西,只需在代码中包含所需的头文件即可。如果您收到此错误:

/usr/include/c++/4.6/boost/date_time/date_formatting.hpp:44: undefined reference to `boost::gregorian::greg_month::as_short_string() const'
/usr/include/c++/4.6/boost/date_time/date_formatting.hpp:49: undefined reference to `boost::gregorian::greg_month::as_long_string() const'

只需 sudo 进入该文件并注释掉这些行。该文档说您需要自己编写这些函数。

于 2012-12-26T19:07:57.870 回答