[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Passing image using SIP
From:       Jarosław Białas <jarekbialas.bialy () gmail ! com>
Date:       2011-06-22 9:21:10
Message-ID: 4E01B406.3040905 () gmail ! com
[Download RAW message or body]

On 21.06.2011 20:02, David Boddie wrote:
> On Mon Jun 20 23:46:27 BST 2011, Jarosław Białas wrote:
>
>> I wanted to create code fragment that will pass an object containg image
>> or pointer to this object from Python to C++ function.
>> I tried to create function:
>> void loadImage(QImage* image);
>> Then I created sip file, and after compiling and linking everything
>> looks fine until I tried to import shared library in python:
>> ImportError: ./test.so: undefined symbol: _ZTI6QImage
>
> It looks like QtGui wasn't linked in when your shared library was created.
> How was the linker run? What command line options and arguments were passed
> to it?
>
> David
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

You were absolutely right. QtGui wasn't linked. But SIP still throw an 
error - sip: Q_PID is undefined. So i add SIP platform tag -t WS_X11.
It wasn't working too - sip: QFileIconProvider is undefined, but after 
extra modification:

$ /usr/bin/sip -c . -I/usr/share/sip -t WS_X11 -t Qt_4_7_2  -b hello.sbf 
hello.sip
$ g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 
-I/usr/include/QtGui -I/usr/include/QtCore -o siphellocmodule.o 
siphellocmodule.cpp
$ g++ -c -pipe -fPIC -O2 -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 
-I/usr/include/QtGui -I/usr/include/QtCore -o siphellohello.o 
siphellohello.cpp
$ g++ -Wl,--hash-style=gnu -Wl,--as-needed -shared 
-Wl,--version-script=hello.exp -o hello.so siphellocmodule.o 
siphellohello.o

I've got: undefined symbol: _ZN5hello9loadImageEP6QImage.I found out 
that I've only declared loadImage. So after all it works fine. Thank you 
for help.
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic