使用.v2扩展名构建Boost日期/时间Jamfile

时间:2012-12-26 17:11:03

标签: c++ boost linker makefile jam

我正在尝试构建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 ;

谢谢, 乔

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分: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到该文件并注释掉这些行。 该文件说你需要自己编写这些功能。