Compiling Swig Wrapper For Python In Windows
Solution 1:
Ok, I managed to do it.
1- Take care that you .i files are encoded in utf-8, as it prevented swig to compile if Python as a different encoding.( #error Must use Python with unicode enabled
)
2- Download swig for Windows on www.swig.org and installing MinGW
3- type in cmd or Powershell
swig -c++ -python test5.i
g++ -c -Wall test5.cpp
g++ -c -Wall test5_wrap.cxx -I C:\Python27\include -I C:\Python27\Lib\site-packages\numpy\core\include\
g++ -Wall -shared -I C:\Python27\include -I C:\Python27\Lib\site-packages\numpy\core\include\ test5.o test5_wrap.o -o _Amod.pyd -L C:/Python27/libs/ -lpython27
-I C:\Python27\Lib\site-packages\numpy\core\include\
solve the Error :
fatal error : numpy\arrayobject.h no such file or directory
-L C:/Python27/libs/ -lpython27
solve the Error :
undefined reference to _imp__Py...
Contrary to the Linux compilation, the library C:/Python27/libs/python27.lib has to be carefully linked, as well as the directores of the headers (C:\Python27\include and for numpy C:\Python27\Lib\site-packages\numpy\core\include) Hope it can helps, but I don't have the feeling it's a very clean job. See this previous post considering the errors I met.
Post a Comment for "Compiling Swig Wrapper For Python In Windows"