#include<Python.h>: Error in included file
-
wrote on 24 May 2022, 01:48 last edited by
I want to run an embedded python script on Qt, but my compiler seem to find a lot of error inside Python.h (more specifically, inside Pyobject.h and sliceobject.h. It might be something called slots, which appeared to be flagged as the Qt slots or it might be a bunch of missing semicolon or parenthesis.
Since these files are from the official python distribution and the include files of the pythonXX.lib library, I would rather not modify them, since this is supposed to be functional.
Would there be a way to prevent my compiler from flagging error within these files?
-
I want to run an embedded python script on Qt, but my compiler seem to find a lot of error inside Python.h (more specifically, inside Pyobject.h and sliceobject.h. It might be something called slots, which appeared to be flagged as the Qt slots or it might be a bunch of missing semicolon or parenthesis.
Since these files are from the official python distribution and the include files of the pythonXX.lib library, I would rather not modify them, since this is supposed to be functional.
Would there be a way to prevent my compiler from flagging error within these files?
@Factao If the problem is the conflict between Python "slots" and Qt "slots" you can set QT_NO_KEYWORDS (see https://github.com/pytorch/pytorch/issues/19405)
-
@Factao If the problem is the conflict between Python "slots" and Qt "slots" you can set QT_NO_KEYWORDS (see https://github.com/pytorch/pytorch/issues/19405)
wrote on 24 May 2022, 13:53 last edited by@jsulm Thank you!
I am also getting a lot of syntax error in this line:
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); Py_DEPRECATED(3.7) PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
These are the line 43 to 49 of sliceobject.h. There apparently is a lot of missing parenthesis and semicolon before a 'constant', but there isn't any apparent conflicting keyword.
-
@jsulm Thank you!
I am also getting a lot of syntax error in this line:
PyAPI_FUNC(int) PySlice_GetIndices(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); Py_DEPRECATED(3.7) PyAPI_FUNC(int) PySlice_GetIndicesEx(PyObject *r, Py_ssize_t length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength);
These are the line 43 to 49 of sliceobject.h. There apparently is a lot of missing parenthesis and semicolon before a 'constant', but there isn't any apparent conflicting keyword.
-
@Factao
Since there is nothing wrong in the C++PySlice_...
declarations, I would assume the macros (PyAPI_FUNC()
,Py_DEPRECATED()
) are not defined when it hits these lines, for whatever reason....wrote on 24 May 2022, 14:05 last edited by@JonB They seem defined for me. Here is what it look like and what their definition seem to be.
-
@JonB They seem defined for me. Here is what it look like and what their definition seem to be.
-
@Factao
Since there is nothing wrong in the C++PySlice_...
declarations, I would assume the macros (PyAPI_FUNC()
,Py_DEPRECATED()
) are not defined when it hits these lines, for whatever reason.... -
@Factao
Those may only be "errors/warnings" coming from the IDE's code completion plugin, which can get things wrong. Do you get those errors when you actually compile?
1/8