Initializer Is Not A Constant, Error C2099, On Compiling A Module Written In C For Python
i tried to compile a python module called distance, whith c 'python setup.py install --with-c' using msvc 2017 on windows 10, i got this error , Cdistance / distance.c (647): erro
Solution 1:
i have found the solution, by looking to the definition of the structure PyTypeObject PyTypeObject , i have changed yVarObject_HEAD_INIT(&PyType_Type, 0)
by PyVarObject_HEAD_INIT(NULL, 0)
and it compiles successfully, and i have tried some functions and it works, so the error is caused by &PyType_Type
which is a PyObject*
, i know that because IFastComp_Type
is a globale varailble it should be initialised by a constante, but i still don't know why the author of the module gave &PyType_Type
as argument , thank you all for your comments.
Post a Comment for "Initializer Is Not A Constant, Error C2099, On Compiling A Module Written In C For Python"