i'm trying use map in cython class cython compiler raises error.
here example demonstrating problem , error reported cython.
cython file pyx
from libcpp.map cimport map libcpp.utility cimport pair libcpp.string cimport string cdef class mydict: cdef: map[string, int] components def __setitem__(self, key, value): self.components[key] = value def __getitem__(self, key): return self.components[key]
python file
from pyximport import install install() dic_class import mydict m = mydict() m["home"] = 5 print m["home"]
error reported cython
fatal error: utility: no such file or directory
you've not done set compile c++ rather c. c compiler unable find c++ standard library (hence "no such file or directory" error).
you need tell pyximport use c++ instead of c setting .pyxbld file. alternatively use setup.py in c++ mode instead of pyximport.
Comments
Post a Comment