我正在发布我的 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 的任何想法?
最佳答案
dynamic_bitset
未在库中定义,它是一个仅包含 header 的增强组件。
您可以在此处找到属于此类的增强组件:
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 header , dir_config()
。
如果您需要灵感,请通过谷歌搜索 extconf.rb 和 boost 以及 have_header,您可能会在 github 上找到一些 extconf.rb 文件。
关于ruby - 在 extconf.rb 中需要 boost::dynamic_bitset<>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7894451/