Cython 无法转换为 int?

Cython cannot convert to int?

使用 Anaconda、Python 3.4 和 Win7 64 位,我无法得到这个 运行:

C代码:

    int addInts(int a, int b)
{
    return a+b;
}

PYX 文件:

cdef extern from "square.cpp":
    int addInts(int, int)

def pAddInts(int a, int b):
    return addInts(a, b)

和测试文件:

res = callCpp.pAddInts(3, 4)

错误信息:

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)

@all double 和 double* 没问题,但整数不起作用.. 这里有什么问题?谢谢!

好的得到解决方案: mingw 不适合这份工作,它必须是 Microsoft VC++。这完美地帮助了: https://github.com/cython/cython/wiki/InstallingOnWindows