Problems while creating a c++ extension with cython -


i'm working on osx 10.8.4 64 bit python 2.7, cython 0.19.1 , numpy 1.6.1.

i'm trying create c++ extension used python. c++ code given , wrote wrapper c++ class make using needed functions in python easier.compiling works importing extension file causes following error:

traceback (most recent call last):   file "<stdin>", line 1, in <module> importerror: dlopen(./mserp.so, 2): symbol not found: __zn4mser12mserdetectorc1ejj   referenced from: ./mserp.so   expected in: flat namespace  in ./mserp.so 

i tried smaller example easy c++ class function has got numpy array argument. importing , using of extension file works great!

here wrapper class (maser_wrapper.cpp):

#include "mser_wrapper.h" #include "mser.h" #include <iostream>  namespace mser {      callmser::callmser(unsigned int imagesizex,unsigned int imagesizey)     {                     //create mserdetector         mser::mserdetector* detector = new mser::mserdetector(imagesizex, imagesizey);     }      callmser::~callmser()     {         delete detector;     } } 

and here cython file (mserp.pyx):

# distutils: language = c++ # distutils: sources= mser_wrapper.cpp cdef extern "mser_wrapper.h" namespace "mser":     cdef cppclass callmser:         callmser(unsigned int, unsigned int) except +  cdef class pycallmser:     cdef callmser *thisptr     def __cinit__(self, unsigned int imagesizex, unsigned int imagesizey):         self.thisptr = new callmser(imagesizex, imagesizey)     def __dealloc__(self):         del self.thisptr 

last not least setup.py:

from distutils.core import setup cython.build import cythonize  setup(ext_modules = cythonize(      "mserp.pyx",                 # our cython source      sources=["mser_wrapper.cpp"],  # additional source file(s)      language="c++",             # generate c++ code   )) 

in namespace "mser" class "mserdetector" exists cannot found. it's defined in header file "mser.h" included wrapper class.

has idea problem be? thanks!

you missing object code mser.cpp. tell cython include adding sources in setup.py , distutil sources in cython file.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -