Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/132.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何使用C++;setuptools.Extension中的头文件?_C++_Cython_Header Files_Setuptools - Fatal编程技术网

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

C++ 如何使用C++;setuptools.Extension中的头文件?,c++,cython,header-files,setuptools,C++,Cython,Header Files,Setuptools,我需要在setuptools.Extension中使用一个文件gzstream.h 如果我尝试使用.h Extension( "epic2.src.cpp_read_files", ["epic2/src/cpp_read_files.pyx", "epic2/src/gzstream.h"], language="c++", /// ... 我得到了错误 error: unknown f

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

如果我尝试使用.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/cpp_read_files.pyx", "epic2/src/gzstream.cpp"],
    language="c++", /// ...
但现在我得到了一个不同但可预测的错误:

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"
虽然我没有一个最小的可复制示例,但我有一个可复制示例:


您真的需要在setup.py中列出它吗?通常,将其包含在.pyx中会导致其包含在生成的.c文件中。您通常不需要单独编译它。问题是当我创建这个项目时,我对货物的崇拜。从未使用过C++的多XD。现在我没有得到那个错误,但得到了一个不同的错误。将产生新的问题。我想你的评论可以是一个答案顺便说一句。如果你觉得你的评论作为一个答案太微不足道,也许可以解释更多或者引用文档中关于扩展的内容。
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.