Debug 版的 C/C++ Python 扩展模块链接错误:Error LNK1104 cannot open file 'python35_d.lib'

LNK1104: cannot open file ‘python34_d.lib’
http://answers.opencv.org/question/68148/lnk1104-cannot-open-file-python34_dlib/

There is an ugly workaround, but there must be a better way. Anyway, the fix is to change the hardcoded DEFAULTLIB on line 325 of pyconfig.h to use the release lib. This is actually someone else’s idea, but I can’t find that post any more.

# if defined(_DEBUG)
//# pragma comment(lib,"python34_d.lib")
# pragma comment(lib,"python34.lib") // no debug lib in python distribution
# elif ...

It is also necessary to undefine Py_DEBUG on line 370 to avoid link errors:

#ifdef _DEBUG
//# define Py_DEBUG
#endif

你可能感兴趣的:(c++,Python)