通过在MSVC上定义的DEBUG来编译python模块 [英] Compiling python modules whith DEBUG defined on MSVC

查看:103
本文介绍了通过在MSVC上定义的DEBUG来编译python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果 DEBUG python26_d.lib >预处理器变量被定义。这是一个问题,因为python安装程序不会附带 python26_d.lib !所以我无法在调试模式下以msvc构建应用程序。如果我暂时只有一个文件 #undef DEBUG ,我会得到很多关于DLL链接不一致的投诉。如果我改变pythons中的pragma包含文件我得到未定义的引用到各种调试功能。



我已经尝试编译我自己的版本的python,但它有点不同于python得到分发,我不能使用我的模块与使用香草版本的python构建的应用程序



任何人都可以给我任何建议如何解决这个问题? p>

谢谢

解决方案

python list


作为这种情况的解决方法,尝试
将文件python26.dll复制到
python26_d.dll。 (我不知道这个
会工作;你说你正在调试模式下建立一个
SWIG库,并且它的
可能是SWIG将尝试使用
的功能Python调试
版本,如果是这样的话,您将
别无选择,只能使用
调试版本的Python。)


编辑:从评论:


你还应该编辑pyconfig.h和
评论出行#define
Py_DEBUG(第374行)



Python rather stupidly has a pragma directive in its include files that forces a link against python26_d.lib when the DEBUG preprocessor variable is defined. This is a problem because the python installer doesn't come with python26_d.lib! So I can't build applications in msvc in debug mode. If i temporarily #undef DEBUG for just one file I get many complaints about inconsistent DLL linkage. If I change the pragma in pythons include file I get undefined references to various debug functions.

I have tried compiling my own version of python but its somehow different enough from the python that gets distributed that I can't use my modules with apps built with the vanilla version of python

Can anyone give me any advice on how to get round this?

Thanks

解决方案

From python list

As a workaround to the situation, try to copy the file python26.dll to python26_d.dll. (I'm not sure this will work; you say you are building a SWIG library in debug mode, and it's possible that SWIG will try to use features of the Python debugging version. If that's the case, you'll have no choice but to use the debugging version of Python.)

Edit: From comments:

You should also edit pyconfig.h and comment out the line "#define Py_DEBUG" (line 374)

这篇关于通过在MSVC上定义的DEBUG来编译python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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