Ade*_*ost 9 c++ python boost visual-studio boost-python
有人能告诉我,如果我做错了什么.
我在Windows 7上使用Visual Studio 2013,我希望能够设置一个简单的Boost.Python项目.我不知道我是否在构建提升或在项目中包含提升时出错了.
错误
当我尝试#include任何boost python模块时,例如#include <boost/python/module.hpp>我在Visual Studio中收到以下错误.
1>c:\boost_1_55_0\boost\python\detail\wrap_python.hpp(50): fatal error C1083: Cannot open include file: 'pyconfig.h': No such file or directory
Run Code Online (Sandbox Code Playgroud)
建造
我试图遵循这个SO线程中的指令,其中KTC解决了Python,以及来自Boost的这个Python howto,但由于这两个链接都有点过时,所以做的事情有所不同,并且一些步骤似乎在较新版本的Boost中有所改变,我不得不即兴发布一些指示.
这就是我做的.
C:\boost_1_55_0.cmd.exe导航到C:\boost_1_55_0.(我没有使用Developer Command Prompt for VS2013发现下\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts.这应该没有任何区别,是否应该?提升1.55的官方指南没有具体提及使用Command Prompt for VS2013.bootstrapcmd.project-config.jam(创建bootstrap)并添加了我的Python 3.4安装路径C:\Python34.我的.jam文件现在看起来像在Project-Config.jam中看到的那样..\b2在cmd中启动构建过程.虽然我在构建期间(forcing value to bool 'true' or 'false' (performance warning)等等)有很多警告,但在构建完成后似乎没有任何错误消息.包含
这就是我在Visual Studio中创建项目的方法.
C:\boost_1_55_0到Include Directories.C:\boost_1_55_0\stage\lib(我可以找到.lib文件的文件夹)到Library Directories.项目 - config.jam中
import option ;
using msvc ;
option.set keep-going : false ;
using python : 3.4 : C:\\Python34\\python ;
Run Code Online (Sandbox Code Playgroud)
测试代码
从: boost_1_55_0\libs\python\example\getting_started1.cpp
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <string>
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; }
}
namespace python = boost::python;
BOOST_PYTHON_MODULE(getting_started1)
{
// Add regular functions to the module.
python::def("greet", greet);
python::def("square", square);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9194 次 |
| 最近记录: |