[PyKDE] Passing C++-created QWidgets to embedded Python

Robin Summerhill robinsummerhill at cyantechnology.com
Wed Apr 10 17:18:52 BST 2002


Hi,

I'm embedding PyQT in a C++ application and am trying to extend the
interpreter with my app's object model.

I know I need to do something like the following to pass a C++-created
widget to Python:

#include <Python.h>
#include <sip.h>
#include <sipqtQWidget.h>

static PyObject *py_getWidget(PyObject *self, PyObject *args)
{
	PyObject* p = sipMapCppToSelf(reinterpret_cast<void*>(pWidget),
sipClass_QWidget);
	return p;
}


However, when I try to link this (MSVC6 with SP5) I get:

error LNK2001: unresolved external symbol "struct _object *
sipClass_QWidget" (?sipClass_QWidget@@3PAU_object@@A)

I'm linking against libsip.lib and libqtc.lib. Looking at the exports from
libqtc.lib with dumpbin, sipClass_QWidget is present and correct with the
right mangled name. Other symbols such as sipQWidget *are* accessible.

I'm probably doing something really stupid but I can't see it. Can anyone
give me any insight or send my some example code that works?

Thanks,
Robin Summerhill
robinsummerhill at cyantechnology.com





More information about the PyQt mailing list