在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中发生了变化,我不得不根据一些说明即兴创作。
这就是我所做的。
- 将Boost源文件的最新版本(1.55)解压到
C:\boost_1_55_0
。- 使用
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
。- 在cmd中使用
bootstrap
。- 编辑过的
project-config.jam
(由bootstrap
创建)并添加了我的Python 3.4安装路径C:\Python34
。 现在我的.jam
文件看起来像在Project-Config.jam中看到的一样。- 在cmd中使用
.\b2
来启动构建过程。 虽然在构建过程中(forcing value to bool 'true' or 'false' (performance warning)
等等),我有很多警告,但在构建完成后似乎没有任何错误消息。包含
这是我在Visual Studio中创建项目的方式。
- 创建了一个新项目。
- 如测试代码所示添加代码。
- 在项目属性中的VC ++目录下:
- 添加
C:\boost_1_55_0
以Include Directories
。- 添加到
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.
- Unziped the latest version (1.55) of Boost source file to
C:\boost_1_55_0
.- Used
cmd.exe
to navigate toC:\boost_1_55_0
. (I did not useDeveloper 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 usingCommand Prompt for VS2013
.- Used
bootstrap
in cmd.- Edited
project-config.jam
(created bybootstrap
) and added path to my Python 3.4 installationC:\Python34
. My.jam
file now looked like as seen in Project-Config.jam.- 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.
- Created a new project.
- Added code as seen in Test Code.
- Under VC++ Directories in Project Properties:
- Added
C:\boost_1_55_0
toInclude Directories
.- Added
C:\boost_1_55_0\stage\lib
(the folder where I could find.lib
files) toLibrary 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
最满意答案
可能是某些列名是MySql保留字(特别是
from
和)。 请逃避他们。INSERT INTO logs (`id`, userid, date, plane, `from`, `to` ...)
May be some of the column names are MySql reserved words (especially
from
andto
). Please escape them.INSERT INTO logs (`id`, userid, date, plane, `from`, `to` ...)
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
可能是某些列名是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`, ` ...
-
mySQL插入只是不起作用,但会与其他表[重复](mySQL insert just won't work, but will with other table [duplicate])[2023-09-29]
GROUP是保留关键字。 您必须正确地转义它,这样才不会产生错误。 INSERT INTO highScores (id, user, `group`, level, score) VALUES(...) MySQL保留关键字列表 作为旁注,如果变量的值来自外部,则查询易受SQL Injection攻击。 请查看下面的文章,了解如何防止它。 通过使用PreparedStatements您可以摆脱使用值周围的单引号。 如何在PHP中防止SQL注入 ? GROUP is a reserved keyword. ... -
您在插入查询中缺少一个值。 请在插入查询中再添加一个值。 剩下的查询很好。 INSERT INTO干预(utilisateur_id,nom_proprietaire,num_tel_proprietaire,courriel_proprietaire,informations_bien,interet,delai,plan_2D,plan_3D,visite_virtuelle,shooting_photo,annee_construction,installation_gaz,cle_agence,ca ...
-
Odbc INSERT不起作用(Odbc INSERT not working)[2022-04-27]
INSET应该是INSERT。 INSET should be INSERT. -
您不需要将$ result传递给mysql_insert_id,您应该传递$ link变量。 You do not need to pass $result to mysql_insert_id you should pass $link variable.
-
我相信vrijwilligerID设置为AUTO_INCREMENT 。 因此,而不是 mysql_query($query); $query =" INSERT INTO vrijwilliger (vrijwilligerID, voornaam, achternaam, gbdatum, geslacht, wachtwoord, woonplaats, adres, telefoonnummer, functie, activiteitID, groepID, email) ...
-
您正在尝试将“text”插入char(2)字段,这将生成截断数据的警告。如果您没有看到该警告,那么您的配置会发生一些非常奇怪的事情,或者显示的架构和查询是与你正在运行的那个不一样 Query OK, 1 row affected, 1 warning (0.03 sec) 也就是说,查询或您发布的架构没有任何问题,我只能假设问题是由于您在解决问题时遗漏了问题。 mysql> INSERT INTO tablename (field0, field1, field2, field3, field4, fie ...
-
正确的语法是 INSERT INTO `competitions` (`name`) SELECT `name` FROM `competitions` 请参阅: INSERT ... SELECT语法 Correct syntax is INSERT INTO `competitions` (`name`) SELECT `name` FROM `competitions` Refer to: INSERT ... SELECT Syntax
-
尝试删除状态参数或将其更改为其他状态但不发布 Try to remove status param or change it to another status but not publish