Eu recebo este erro de vinculação usando o Python 2.4 e o 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
Adicionar isso ao meu arquivo de origem não ajudou:
#undef _DEBUG
Eu modifiquei pyconfig.h para desabilitar o modo de depuração e forçar o uso de python24.lib em vez de python24_d.lib como mostrado aqui: http://tutorial.debashis.net/?p=57&cpage=1 Ainda assim, o mesmo erro.
O que eu poderia estar fazendo errado?
Respostas:
7 para resposta № 1Desde que você diz que você está ligando contra o.lib, pode ser que você tenha instalado a versão de 64 bits do Python e esteja, portanto, vinculando-se à versão de 64 bits do arquivo .lib, mas sua configuração de compilação é (suspeito) de 32 bits. Vá para o Configuration Manager e altere-o para 64 bits.
Espero que isto ajude. Marius