.NET c++ and python: unresolved external __imp__XXXXXXXXXX

G

Guest

Hi,

I am trying to build an dll with Microsoft Visual C++ but during the linking
phase I get linking errors.

Script.obj : error LNK2019: unresolved external symbol
__imp__PyString_AsString referenced in function "public: static struct
_object * __cdecl SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyObject_Repr
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__Py_BuildValue
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyFloat_Type
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol
__imp__PyTuple_GetItem referenced in function "public: static struct _object
* __cdecl SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyTuple_Size
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyTuple_Type
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyList_SetItem
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyList_New
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyList_GetItem
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.obj : error LNK2019: unresolved external symbol __imp__PyList_Size
referenced in function "public: static struct _object * __cdecl
SomeFunctionName
Script.dll : fatal error LNK1120: 20 unresolved externals

The lib and exp files are generated but not the dll.
I'm using Visual C++ 7.1.3088, .NET 1.1.4322 SP1, Python2.1.1 and Windows
XP. I've checked in the Pyhon lib and the externals that start with __imp__
does not exist in the lib but the externals without the __imp__ does, i.e
_PyList_Size.

Maybe I should add that I can compile the dll with borland and I am now
trying to get the code to work with visual c++ as well.

I think the problem is that the __imp__ prefix is added to the variables by
mistake. Maybe because of some setting that I missed or got wrong in the
visual environment.

Does anyone recognise this problem?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top