游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2041|回复: 1

为什么没有脚本交流区?为什么链接时cannot open file &qu

[复制链接]

31

主题

249

帖子

259

积分

中级会员

Rank: 3Rank: 3

积分
259
发表于 2007-3-20 16:41:00 | 显示全部楼层 |阅读模式
没有脚本交流区?
我想学Python-C,可是
为什么链接时会出现cannot open file "python25_d.lib"?

9

主题

688

帖子

688

积分

高级会员

Rank: 4

积分
688
发表于 2007-3-21 20:10:00 | 显示全部楼层

Re:为什么没有脚本交流区?为什么链接时cannot open file &quo

The Debug Library
In practice, there’s a slight issue with the Python.org 2.2 distribution; the python22_d.lib file is
missing, at least in its compiled form. You can download the source and build it yourself, but for
now, running any Python program will result in the following linker error:
LINK : fatal error LNK1104: cannot open file "python22_d.lib"
The reason for this error is that python22_d.lib is the debug version of the library, with extra
debug-specific features. When you compile your project in debug mode, special flags in the
Python library’s header files will attempt to use this particular .LIB file, which won’t be available
and thus result in the error. Rather than waste your time compiling anything, however, it’s a lot
easier to resolve this situation by simply forcing Python to use the non-debug version in all cases.
To do this, open up pyconfig.h in the Python installations include/ directory. Go to line 335,
which should be the first in this block of code:
#ifdef _DEBUG
#pragma comment(lib,"python22_d.lib")
#else
#pragma comment(lib,"python22.lib")
#endif
#endif /* USE_DL_EXPORT */
The first change to make is on the second line in this block. Change python22_d.lib to
python22.lib, and you should be left with this:
#ifdef _DEBUG
#pragma comment(lib,"python22.lib")
#else
#pragma comment(lib,"python22.lib")
#endif
#endif /* USE_DL_EXPORT */
The next and final change to make is right below on line 342:
#ifdef _DEBUG
#define Py_DEBUG
#endif
Just comment these three lines out entirely, so they look like this:
/*
#ifdef _DEBUG
6. INTEGRATION: USING EXISTING SCRIPTING SYSTEMS
265
#define Py_DEBUG
#endif
*/
That’s everything, so save pyconfig.h with the changes and the Python library will use the nondebug
version of python22.lib in all cases. Everything should run smoothly from here on out.

这是在《game scripting mastery》找到的,python2.5一样有这个问题。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 19:15

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表