I managed to get Cython working for a simple C++ file. But when I tried to get it to work for our project, I got a path issue.
When I run "python3.6 setup.py build_ext --inplace", I got these errors:
myapp.h:12:10: fatal error: base/file1.h: No such file or directory
#include <base/file1.h>
^~~~~~~~~~~
Here is my folder structure:
.
|-- base
| |-- file1.h
| \-- file1.cpp
|
|-- app
| |-- app.pyx
| \-- setup.py
|
|-- myapp.cpp
\-- myapp.h
Here is the setup.py:
from distutils.core import setup, Extension
from Cython.Build import cythonize
setup(ext_modules = cythonize(Extension(
"app",
sources=["app.pyx", "myapp.cpp"],
language="c++",
)))
In myapp.h, there is this line:
#include <base/file1.h>
You're looking for the include_dirs parameter of setup. In your case, this should work:
setup(...
include_dirs = ['.'],
... )
Or maybe '..', your directory tree is a bit unusual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With