Reputation: 405
I was previously working with python 2.7.9 to wrap some c++ code using swig (version 2.0.12) and everything was working well. I then switched over to python 3.7.3 and have been having issues with running swig like I was before.
This is my error message in my terminal:
ImportError: /home/_add_array.so: undefined symbol: PyClass_Type
I can imagine two possible solutions:
The command line commands I'm making to get swig to generate files need to be changed.
I need to update to a newer version of swig.
If it's case 1, what about my previous commands aren't correct:
swig -c++ -python add_array.i
g++ -fpic -c add_array_wrap.cxx add_array.h add_array.cpp -I/usr/include/python2.7
g++ -shared add_array_wrap.o add_array.o -o _add_array.so
If it's case 2, what version of swig is compatible with python 3.7.3? I'm running Ubuntu, in case that's relevant.
Thanks!
Upvotes: 0
Views: 502
Reputation: 249283
This part is certainly wrong:
-I/usr/include/python2.7
You need to update that to point to your new Python 3.7 installation.
Upvotes: 1