|
|
发表于 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一样有这个问题。 |
|