Cython can't convert to int?
using Anaconda, Python 3.4 and Win7 64bit, I cannot run this:
C Code:
int addInts(int a, int b)
{
return a+b;
}
PYX file:
cdef extern from "square.cpp":
int addInts(int, int)
def pAddInts(int a, int b):
return addInts(a, b)
and a test file:
res = callCpp.pAddInts(3, 4)
error message:
Traceback (most recent call last):
File "testScript.py", line 9, in <module>
res = callCpp.pAddInts(a, b)
File "callCpp.pyx", line 16, in callCpp.pAddInts (callCpp.cpp:952)
def pAddInts(int a, int b):
TypeError: __int__ returned non-int (type int)
No @all problem with double and double *, but ints doesn't work. What is the problem? Thank!
+3
source to share
1 answer
The solution worked well: mingw is NOT good for this job, it should be Microsoft VC ++. This helped perfectly: https://github.com/cython/cython/wiki/InstallingOnWindows
0
source to share