3

I get this linking error, using Python 2.4 and 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

Adding this to my source file did not help:

#undef _DEBUG 

I modified pyconfig.h to disable debug mode and force use of python24.lib instead of python24_d.lib as shown here: http://tutorial.debashis.net/?p=57&cpage=1 Still, same error.

What could i be doing wrong?

A.R.
  • 1,888
  • 2
  • 14
  • 22

1 Answers1

9

Since you say that you are linking against the .lib, it may be that you have installed the 64 bit version of Python, and are thus linking against 64-bit version of the .lib file, but your build configuration is (I suspect) 32 bit. Go to Configuration Manager and change it to 64 bit.

Hope this helps. Marius.

Marius Myburg
  • 143
  • 1
  • 8
  • I changed my configuration to x64 and then the project could no longer link with MSVCP120.dll. – James Dec 17 '15 at 02:31