我正在编写一个代码,从c++中编辑Sqlite数据库,然后使用PyBind11与python一起使用程序。我安装了PyBind11,构建了它直到这里没有问题,但当我构建代码时,它显示了一个错误:
/usr/include/python3.10/object.h:227: error: expected unqualified-id before ‘;’ token
In file included from /usr/include/python3.10/Python.h:74,
from /usr/local/include/pybind11/detail/common.h:266,
from /usr/local/include/pybind11/attr.h:13,
from /usr/local/include/pybind11/detail/class.h:12,
from /usr/local/include/pybind11/pybind11.h:13,
from /media/raghav/Sector 16/core/database.cpp:21:
/usr/include/python3.10/object.h:227:23: error: expected unqualified-id before ‘;’ token
227 | PyType_Slot *slots; /* terminated by slot==0. */
| ^否则,我的代码工作正常,但我被困在这件事上。我用的是以下几点:
请帮帮我。提前感谢
发布于 2023-05-04 13:58:06
谢谢你的支持。解决方案是在导入Qt模块和使用pybind11之前导入#define PYBIND11_NO_KEYWORDS。
https://askubuntu.com/questions/1466530
复制相似问题