問題描述
在使用QT Creator構建C++項目時,因為要使用Python腳本,所以要調用Python.h文件
在使用時發現會出現錯誤
E:\Anconda\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 <QMainWindow>的前面,頭文件的順序不正確也會報錯。