I am trying to build Cython to try to call C functions from python by trying to link cython with C headers. When I try to use this command to build python
python setup.py build_ext --inplace
it shows this error:
running build_ext building 'cython' extension /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -arch i386 -arch x86_64 -g -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cython.c -o build/temp.macosx-10.6-intel-2.7/cython.o cython.c:692:14: error: typedef redefinition with different types ('void' vs 'struct _typeobject') typedef void PyTypeObject; ^ /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:411:3: note: previous definition is here } PyTypeObject; ^ 1 error generated. error: command '/usr/bin/clang' failed with exit status 1
Edit: my cython.pyx looks like this:
cdef extern from "rnafoldenergy.h": float dostuff(int maxw, char *sequence2, char *sequence3, float *freeenergy) cpdef int dothings(): print "Hello!" cdef int maxw = 50 cdef float freeenergyarray[3] freeenergyarray[:] = [0, 0, 0] cdef char* sequence2 = "AAACATTGAAAATAAGAGTACATGAAGGATATGAGGAATTCACAATGGTTGGGCGAAGAGCAACAGCCATTCTAAGGAAAGCAACCAGAAGACTGATCCAACTGATAGTGAGTGGGAAAG" cdef char* sequence3 = "ATCCTTCATGTACTCTTATTTTCAATGTTTATAAAAGAGGAGAAATATAAAATGTGAAAATAAAACCTGGCGGCAGCGCAAAAG" cdef float interactenergy=0 interactenergy=dostuff(maxw=maxw, sequence2=sequence2, sequence3=sequence3, freeenergy=freeenergyarray) print "A: %f, B: %f, AB: %f, Interact: %f" % (freeenergyarray[0],freeenergyarray[1],freeenergyarray[2],interactenergy) return 0