如何在setuptools.Extension中使用C ++头文件?

问题描述

我有一个文件gzstream.h,需要在我的setuptools.Extension中使用。

如果我尝试使用.h

 Extension(
    "epic2.src.cpp_read_files",["epic2/src/cpp_read_files.pyx","epic2/src/gzstream.h"],language="c++",/// ...

我得到了错误

error: unkNown file type '.h' (from 'epic2/src/gzstream.h')

如果我尝试使用.cpp,它将起作用:

 Extension(
    "epic2.src.cpp_read_files","epic2/src/gzstream.cpp"],/// ...

但是现在我得到了一个不同但可预测的错误

clang: error: no such file or directory: 'epic2/src/gzstream.cpp' 

我不能仅将.h文件重命名为gzstream.cpp,因为这样我会收到错误

epic2/src/read_files.cpp:202:10: Fatal error: 'gzstream.h' file not found
#include "gzstream.h"

虽然我没有可复制的最小示例,但我有一个可复制的示例:

https://github.com/biocore-ntnu/epic2

git clone https://github.com/biocore-ntnu/epic2.git
cd epic2
pip install pysam
python setup.py install # Now you should see my header-woes.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)