QT C++调用python之错误:XXX\python\include\object.h:227: error: C2059: 语法错误:“;”

好心情美文 / 2024-09-25 / 原文

问题:

 

解决:

1、重命名C++中的slots

class MyClass {
public:
    PyType_Slot *slotTable;
};

 

2、在includ <Python.h>前使用#undef取消定义

#ifdef slots
#undef slots
#endif
#include <Python.h>