我想为C ++代码编写一个包装器。我的最终目标是使用python访问用C ++编写的类及其函数,但是现在,我只是想为hello world程序编写一个简单的包装器。 所以,我在线查看并看到boost.python能够执行这样的壮举。 Their tutorial 虽然不是那么清楚。我试图遵循它,但我迷路了。此教程基于Windows系统,我正在使用mac,因此它给我带来了更多的困惑 我通过自制软件安装了boost和bjam。
brew install boost --with-python
brew install bjam
我想要包装的代码。
#include <iostream>
char const* greet(){
return "hello world!"
}
你能帮我解决这个问题吗?
目前,我按照教程中的指示下载了Jammroot
script,并将use-project boost
编辑到boost
(/usr/local/Cellar/boost
)的当前位置。
然后,当我尝试从终端运行bjam时,我得到以下错误
Jamroot:17: in modules.load
*** argument error
* rule use-project ( id : where )
* called with: ( boost : /usr/local/Cellar/boost; project boost-python- quickstart : requirements <library>/boost/python//boost_python <implicit-dependency>/boost//headers : usage- requirements <implicit-dependency>/boost//headers )
* extra argument project
/usr/local/share/boost-build/src/build/project.jam:1138:see definition of rule 'use-project' being called
/usr/local/share/boost-build/src/build/project.jam:311: in load-jamfile
/usr/local/share/boost-build/src/build/project.jam:64: in load
/usr/local/share/boost-build/src/build/project.jam:145: in project.find
/usr/local/share/boost-build/src/build-system.jam:535: in load
/usr/local/share/boost-build/src/kernel/modules.jam:289: in import
/usr/local/share/boost-build/src/kernel/bootstrap.jam:139: in boost-build
/usr/local/share/boost-build/boost-build.jam:8: in module scope