I am learning to call c in python program by CFFI and write c file named 'add.c' as below :
float add(float f1, float f2)
{
return f1 + f2;
}
and a python file named 'demo.py' to call add method in 'add.c':
from cffi import FFI
ffi = FFI()
ffi.cdef("""
float(float, float);
""")
C = ffi.verify("""
#include 'add.c'
""", libraries=[]
)
sum = C.add(1.9, 2.3)
print sum
When I run demo.py, I get the error that add.c file cannot be found. Why file add.c cannot be found and how can I to fix it?