Python愚蠢地在其include文件中有一个pragma指令,当 DEBUG 定义了预处理程序变量。这是一个问题,因为python安装程序没有随附 python26_d.lib !因此,我无法在MSVC中以调试模式构建应用程序。如果我仅对一个文件临时 #undef DEBUG ,我会收到很多有关DLL链接不一致的投诉。如果我更改python包含文件中的编译指示,则会得到未定义的对各种调试函数的引用。
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.
我尝试编译自己的python版本,但它与python有所不同
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?
推荐答案来自 Python列表
作为一种解决方法,请尝试将文件python26.dll复制到 python26_d.dll。 (我不确定这是否会工作;您说您是在调试模式下构建 SWIG库,SWIG可能会尝试使用的功能) Python调试版本。如果是这种情况,您将别无选择,只能使用Python的调试版本。)
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.)
编辑:从注释:
您还应该编辑pyconfig.h和注释在 #define Py_DEBUG行(第374行)
You should also edit pyconfig.h and comment out the line "#define Py_DEBUG" (line 374)
更多推荐
使用MSVC上定义的DEBUG编译python模块
发布评论