Search code examples
pythonccythoncode-translation

'unknown type name' error while using Cython to generate C code


I have successfully generated .c file using Cython, but when i try to compile it using gcc, i get these errors... This is just the first line of the error... There are 3 pages of errors similar to this... My .py code is a simple:

print "test"

error:

unknown type name ‘Py_UNICODE’
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)

Solution

  • See this mailing list post.

    Citing it:

    Cython is not a Python to C compiler in the sense that it does away
    with the Python interpreter/runtime, rather it creates .c files that
    are compiled against the Python/C API and can be loaded into a running
    session. 
    

    See this list of interpreters which lists some compilers that might be useful to you!

    For a guide to compilation, also have a look at the compilation page of the Cython wiki