By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,481 Members | 3,170 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,481 IT Pros & Developers. It's quick & easy.

.NET c++ and python: unresolved external __imp__XXXXXXXXXX

P: n/a
Ida
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?
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.