使用CMake和Pybind11构建Python Wheel时出现头文件包含错误
Pybind11 C++项目打包pip包时头文件包含错误问题
我正尝试为带有Pybind11 Python绑定的C++项目制作pip包,但每次执行python3 -m build构建wheel时都会出现头文件包含错误,尝试多种方法都无法解决。
已尝试的操作
项目结构1
src/ header1.hpp header2.hpp mainheader.hpp mainfile.cpp pythonbindings.cpp
在mainheader.hpp中尝试过以下头文件包含写法:
#include "header1.hpp"#include "src/header1.hpp"#include "./header1.hpp"
构建时报错找不到mainheader.hpp。
项目结构2(由cookiecutter C++项目生成)
include/ header1.hpp header2.hpp mainheader.hpp python/ pythonbindings.cpp src/ mainfile.cpp
构建时报错找不到header1.hpp。
若需要查看我的CMake、setup.py或pyproject.toml文件,请告知,我会提供。
内容的提问来源于stack exchange,提问作者Deepflea18
相关产品推荐
相关产品推荐

