4

我在我的项目中使用 boost build,现在我想使用 boost date_time。我用谷歌搜索并发现它应该(可能)以这种方式使用:

exe test : test.cpp /boost/date_time//date_time ;

但后来我收到这条消息:

error: Unable to find file or target named
error:     '/boost/date_time//date_time'
error: referred from project at
error:     '.'

(当我-lboost_date_time手动用作 gcc 标志时,它可以正常工作)我认为必须将库 oly 添加到 site-config.jam,所以我尝试添加:

project /boost/date_time ;
lib date_time ;

但它没有效果。

我究竟做错了什么?

塔克斯

编辑:我不是在寻找一个可行的解决方案。我需要一些对正确安装 boost.build 和 boost 库的人都有效的东西。

4

2 回答 2

2

我建议您查看当前版本的 Boost.Build 中的 contrib/boost.jam 模块。它允许您几乎自动地为每个库声明必要的目标。

或者最初的尝试并不完全正确。要让“/site-config//boost_date_time”正常工作,您需要在 site-config.jam 中有这个:

project site-config ;
searched-lib boost_date_time ;

如果库文件被命名为 libboost_date_time.so(如果 Boost 是使用 --layout=system 构建的就是这种情况),这将在 Linux 上工作。在 Windows 上,由于自动链接,您实际上不需要任何这些。

于 2009-06-21T16:58:37.753 回答
1

我在提升构建方面没有大量经验,但我相信您在站点配置中的规范已关闭(请参见此处此处)。如果您尝试在您的站点配置中放置一个预建的 boost_date_time,那么它应该是:

project site-config ;
lib b_date_time : : <name>boost_date_time ;

在您的目录中:

exe test : test.cpp /site-config//b_date_time ;
于 2009-06-21T04:35:16.143 回答