3

我正在发布我的 Ruby C/C++ 扩展,并尝试确保所有需要的库都列在 extconf.rb 中。我无法弄清楚如何需要 boost 库,尤其是 dynamic_bitset<> 类。

到目前为止我尝试了什么:

# Require used libraries
have_library("stdc++")
have_library("boost", "boost::dynamic_bitset<>")

即使我已经安装了 boost,并且扩展编译得很好,我得到了这个:

$ ruby extconf.rb
checking for main() in -lstdc++... yes 
checking for boost::dynamic_bitset<>() in -lboost... no

关于如何正确要求安装 boost 的任何想法?

4

1 回答 1

0

dynamic_bitset没有在库中定义,它是一个只有头文件的 boost 组件。您可以在此处了解哪些 boost 组件属于这种类型:

http://www.boost.org/doc/libs/1_57_0/more/getting_started/unix-variants.html#header-only-libraries

我测试了它,例子在

http://www.boost.org/doc/libs/1_57_0/libs/dynamic_bitset/example/example1.cpp

在没有任何库的情况下编译:

g++ example1.cpp -o boost_test

因此,您根本不必查找 boost 库,但您可能想使用have_header(), find_header(),查找 boost 标头dir_config()

如果你需要灵感,谷歌搜索 extconf.rb 和 boost 和 have_header,你可能会在 github 上找到一些 extconf.rb 文件。

于 2015-01-18T18:01:42.887 回答