QT使用python时出现: error: expected unqualified-id before “;” token

在使用QT Creator构建C++项目时,因为要使用Python脚本,所以要调用Python.h文件

在使用时发现会出现错误

H:\Python\Python37\include\object.h:448: error: expected unqualified-id before ‘;’ token
PyType_Slot slots; / terminated by slot==0. */

在这里插入图片描述
出现这个问题和项目本身无关 因为错误的文件在Python的include\object.h
在这里插入图片描述
应该是头文件使用出现问题

解决

后经过尝试发现#include <Python.h>要放在#include 的前面,头文件的顺序不正确也会报错。

猜你喜欢

转载自blog.csdn.net/qq_45662588/article/details/120541586