我得到这个链接错误,使用 Python 2.4 和 MS VC++ 6:
Linking...
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__Py_Finalize
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyErr_Occurred
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyErr_Print
testPyEmb.obj : error LNK2001: unresolved external symbol _printf
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyInt_AsLong
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyObject_CallObject
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyTuple_SetItem
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyInt_FromLong
testPyEmb.obj : error LNK2001: unresolved external symbol _atoi
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyTuple_New
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyCallable_Check
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyObject_GetAttrString
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyImport_Import
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__PyString_FromString
testPyEmb.obj : error LNK2001: unresolved external symbol __imp__Py_Initialize
testPyEmb.obj : error LNK2001: unresolved external symbol _fprintf
testPyEmb.obj : error LNK2001: unresolved external symbol __iob
将此添加到我的源文件没有帮助:
#undef _DEBUG
我修改了 pyconfig.h 以禁用 Debug模式并强制使用 python24.lib 而不是 python24_d.lib,如下所示:http://tutorial.debashis.net/?p=57&cpage=1 仍然是同样的错误。
我做错了什么?
最佳答案
既然你说你链接的是 .lib,可能是你安装了 64 位版本的 Python,因此链接的是 64 位版本的 .lib 文件,但是你的构建配置是(我怀疑)32 位。转到 Configuration Manager 并将其更改为 64 位。
希望这对您有所帮助。 马吕斯。
关于c++ - 如何使用 VS C++ 6.0 在 C++ 应用程序中嵌入 Python 2.4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16094343/