On 25-Apr-02 "Smith, Dave" <[EMAIL PROTECTED]> wrote: > I'm trying my hand at wrapping a C++ class derived from QWidget > and not having much luck with SIP. I've seen some postings on > this list that discuss the same error but I wasn't able to > determine if there was a resolution or not... Any help would be > appreciated!!! > The problem: > Trying to SIP a very simple C++ class that derives from > QWidget (see attached test.sip, I think test.h and test.cxx > are simple enough to leave to the imagination) results in the > following error: > $ sip -c sip test.sip > sip: QWidget has not been defined. > NOTE: I was able to use SIP to successfully create a working > siptest python module before I added the QWidget stuff. > I have tried specifying -t Qt_3_0_2 -t WS_X11
Correct (for Solaris --- -t WS_WIN for Windows). > and messing with the -I option (it is not at all clear to me > what includes sip might require, and I suspect this might be > my problem). You need -I <directory where PyQt sip files are> > Any idea what I'm missing? add %Import qtmod.sip after the %Module statement. sip needs to see .sip files that resolve everything back to C++ base types (the same as C++ would need to see the entire object hierarchy to compile), so it needs to see at least qwidget.sip and qobject.sip, plus anything else QWidget depends on in Qt. You could also just %Include the PyQt .sip files you need if it's only a few (instead of importing all of PyQt) - that may be a little more complicated than it first appears because of versioning/platform/features requirements. sip will generate .h files for all of the Qt sip files in your output directory, but no additional .cpp files. You'll also need to link to libqtcmodule.so and libsip.so (in python/site-packages on Linux), which is why you need the PyQt .h files. I can't advise you on what Windows requires since I don't use it, but it's basically similar. Jim _______________________________________________ PyKDE mailing list [EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
