首页 \ 问答 \ 在VS2013中构建/包括Boost.Python(Building/including Boost.Python in VS2013)

在VS2013中构建/包括Boost.Python(Building/including Boost.Python in VS2013)

有人可以告诉我,如果我做错了什么。

我在使用Visual Studio 2013的Windows 7上,我希望能够设置一个简单的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

建造

我试图遵循这个SO线程中的指令,在这个线程中KTC解决了Python问题 ,以及来自Boost的这个Python howto ,但是由于这两个链接有点过时,所以它们的做法有所不同,而且一些步骤似乎在更新版本的Boost中发生了变化,我不得不根据一些说明即兴创作。

这就是我所做的。

  1. 将Boost源文件的最新版本(1.55)解压到C:\boost_1_55_0
  2. 使用cmd.exe导航到C:\boost_1_55_0 。 (我没有在\Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts下使用Developer Command Prompt for VS2013这应该没有什么区别,应该是这样吗? 提升1.55官方指南并没有特别提及使用Command Prompt for VS2013
  3. 在cmd中使用bootstrap
  4. 编辑过的project-config.jam (由bootstrap创建)并添加了我的Python 3.4安装路径C:\Python34 。 现在我的.jam文件看起来像在Project-Config.jam中看到的一样。
  5. 在cmd中使用.\b2来启动构建过程。 虽然在构建过程中( forcing value to bool 'true' or 'false' (performance warning)等等),我有很多警告,但在构建完成后似乎没有任何错误消息。

包含

这是我在Visual Studio中创建项目的方式。

  1. 创建了一个新项目。
  2. 测试代码所示添加代码。
  3. 在项目属性中的VC ++目录下:
    1. 添加C:\boost_1_55_0Include Directories
    2. 添加到Library Directories C:\boost_1_55_0\stage\lib (我可以找到.lib文件的文件夹)。

项目- config.jam中

import option ; 

using msvc ; 

option.set keep-going : false ; 

using python : 3.4 : C:\\Python34\\python ;

测试代码

来自: 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);
}

Can someone tell me if I'm doing anything wrong.

I'm on Windows 7 using Visual Studio 2013 and I would like to be able to be able to setup a simple Boost.Python project. I don't know if I've made something wrong building boost or when including boost in my project.

Error

When I try to #include any boost python module, e.g. #include <boost/python/module.hpp> I get the following error in 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

Building

I tried to follow instructions from this SO thread in which KTC addresses Python, and this Python howto from Boost, but since both links are bit dated, are doing things differently, and some of the steps seems to have changed in newer versions of Boost, I had to improvise on some of the instructions.

This is what I did.

  1. Unziped the latest version (1.55) of Boost source file to C:\boost_1_55_0.
  2. Used cmd.exe to navigate to C:\boost_1_55_0. (I did not use Developer Command Prompt for VS2013 found under \Microsoft Visual Studio 12.0\Common7\Tools\Shortcuts. This shouldn't make any difference, should it? Boosts official guide for 1.55 didn't make any specific mentioning of using Command Prompt for VS2013.
  3. Used bootstrap in cmd.
  4. Edited project-config.jam (created by bootstrap) and added path to my Python 3.4 installation C:\Python34. My .jam file now looked like as seen in Project-Config.jam.
  5. Used .\b2 in cmd to start the build process. While I had a lot of warnings during the built (forcing value to bool 'true' or 'false' (performance warning), etc.), it didn't seem to be any error messages after the built was finished.

Including

This is how I created my project in Visual Studio.

  1. Created a new project.
  2. Added code as seen in Test Code.
  3. Under VC++ Directories in Project Properties:
    1. Added C:\boost_1_55_0 to Include Directories.
    2. Added C:\boost_1_55_0\stage\lib (the folder where I could find .lib files) to Library Directories.

Project-Config.jam

import option ; 

using msvc ; 

option.set keep-going : false ; 

using python : 3.4 : C:\\Python34\\python ;

Test Code

From: 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);
}

原文:https://stackoverflow.com/questions/23763373
更新时间:2023-06-13 07:06

最满意答案

可能是某些列名是MySql保留字(特别是from和)。 请逃避他们。

INSERT INTO logs (`id`, userid, date, plane, `from`, `to` ...)

May be some of the column names are MySql reserved words (especially from and to). Please escape them.

INSERT INTO logs (`id`, userid, date, plane, `from`, `to` ...)

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。