MSVC - boost :: python静态链接到.dll(.pyd) [英] MSVC - boost::python static linking to .dll (.pyd)

查看:347
本文介绍了MSVC - boost :: python静态链接到.dll(.pyd)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VS10项目。我想构建一些C ++代码,所以我可以在python中使用它。我按照boost教程,让它工作。但是VS一直链接boost-python-vc100-mt-gd-1_44.lib,但它只是一个包装程序调用boost-python-vc100-mt-gd-1_44.dll。这就是为什么我需要复制.dll与我的.dll(.pyd)文件。所以我想链接boost:python静态到那个.dll(.pyd)文件。但我只是在VS或在编译器和链接器手册中找不到任何配置选项。最奇怪的是我有一个更旧的项目使用boost :: filesystem与完全相同的配置,但该项目链接到libboost文件系统 - *。lib是静态lib所以没关系。我已经谷歌搜索了几个小时没有任何成功,它驱使我疯了。

I got a VS10 project. I want to build some C++ code so I can use it in python. I followed the boost tutorial and got it working. However VS keeps to link boost-python-vc100-mt-gd-1_44.lib but it's just a wrapper which calls boost-python-vc100-mt-gd-1_44.dll. That's why I need to copy the .dll with my .dll(.pyd) file. So I want to link boost:python statically to that .dll(.pyd) file. But I just can't find any configuration option in VS or in the compiler and linker manual. The weirdest thing is I've got one older project using boost::filesystem with the very same config but that project links against libboost-filesystem-*.lib which is static lib so it's ok. I've been googling for couple of hours without any success and it drivers me crazy.

感谢任何帮助或建议。

推荐答案

链接的库取决于项目的设置。有两种可能:

What libraries are linked depends on the settings of your project. There are two possibilities: You can build against


  1. 动态


c运行时库的链接版本。根据选择的选项,boost会向链接器发送正确的 #pragma 。这些选项需要在构成程序的所有项目中一致设置。所以去属性 - > c ++ - >代码生成(或类似,我只是猜测,没有VS up和运行现在),并确保正确的选项设置(一致)。当然,你必须在...之前以必需的格式编译boost库。

linked versions of the c-runtime libs. Depending on which option is selected, the boost sends a proper #pragma to the linker. These options need to be set consistently in all projects which constitute your program. So go to "properties -> c++ -> code generation" (or similar, I am just guessing, don't have VS up and running right now) and be sure that the right option is set (consistently). Of course, you must have compiled boost libraries in required format before...

这篇关于MSVC - boost :: python静态链接到.dll(.pyd)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆