有一些问题,现在我已经阅读了以下内容:
我已经尝试在我的桌面上安装boost,并按照链接方面建议的帖子完成.我有以下代码:
#include <boost/python.hpp>
#include <Python.h>
using namespace boost::python;
Run Code Online (Sandbox Code Playgroud)
现在我尝试连接以下内容:
g++ testing.cpp -I /usr/include/python2.7/pyconfig.h -L /usr/include/python2.7/Python.h
-lpython2.7
Run Code Online (Sandbox Code Playgroud)
我也尝试了以下内容:
g++ testing.cpp -I /home/username/python/include/ -L /usr/include/python2.7/Python.h -lpython2.7
Run Code Online (Sandbox Code Playgroud)
我一直收到以下错误:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such
file or directory
# include <pyconfig.h>
Run Code Online (Sandbox Code Playgroud)
我不知道我哪里错了.我确实安装了boost.python,链接只是一个问题?
我从ubuntu 9.04存储库安装了boost python.我从教程中成功运行 了使用Boost构建一个简单程序,所以我知道我的系统上安装了boost python.
但是,以下程序会返回错误:
#include <string>
namespace { // Avoid cluttering the global namespace.
// A couple of simple C++ functions that we want to expose to Python.
std::string greet() { return "hello, world"; }
int square(int number) { return number * number; }
}
#include <boost/python.hpp>
using namespace boost::python;
BOOST_PYTHON_MODULE(getting_started1)
{
// Add regular functions to the module.
def("greet", greet);
def("square", square);
}
Run Code Online (Sandbox Code Playgroud)
我尝试从以下两个步骤执行第一步来创建共享库:
g++ -c -fPIC hello.cpp -o hello.o
g++ -shared -Wl,-soname,libhello.so -o libhello.so hello.o …Run Code Online (Sandbox Code Playgroud)