J'apprends l'usage de SIP (pas le protocole, mais le générateur de code). Pour cela, je suis ce tuto :
http://pyqt.sourceforge.net/Docs/sip4/using.html
Dans la section C++, tout fonctionne comme il faut, jusqu'à :
Code : Tout sélectionner
$ make
g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o sipwordcmodule.o sipwordcmodule.cpp
g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o sipwordWord.o sipwordWord.cpp
g++ -Wl,-z,relro -shared -Wl,--version-script=word.exp -o word.so sipwordcmodule.o sipwordWord.o -lword
/usr/bin/ld: cannot find -lword
collect2: error: ld returned 1 exit status
Makefile:36: recipe for target 'word.so' failed
make: *** [word.so] Error 1
Code : Tout sélectionner
< makefile.extra_libs = ["word"]
---
> makefile.extra_libs = []
Code : Tout sélectionner
$ python configure.py
$ make
g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o sipwordcmodule.o sipwordcmodule.cpp
g++ -c -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Wall -W -DNDEBUG -I. -I/usr/include/python2.7 -o sipwordWord.o sipwordWord.cpp
g++ -Wl,-z,relro -shared -Wl,--version-script=word.exp -o word.so sipwordcmodule.o sipwordWord.o
Code : Tout sélectionner
$ python
Python 2.7.12 (default, Jun 29 2016, 08:18:26)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import word
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: ./word.so: undefined symbol: _ZNK4Word7reverseEv