I have a pretty basic question regarding building Python extensions with C++. In one of my header files, I have a line #include "veins_python/veins_python.h"
, which is a relative path that Python does not see. When I run python setup.py build
, I get
In file included from MyVeinsAppRoss.cc:24:
MyVeinsAppRoss.h:25:10: fatal error: veins_python/veins_python.h: No such file or directory
25 | #include "veins_python/veins_python.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I have tried to give an give an absolute path to veins_python.h
in my setup.py
file
module1 = Extension('MyTest',
include_dirs = ["~/veins_python_practice/src/veins_python"],
sources = ['MyVeinsAppRoss.cc']
)
and also the path just before the veins_python
directory
module1 = Extension('MyTest',
include_dirs = ["~/veins_python_practice/src"],
sources = ['MyVeinsAppRoss.cc']
)
But the error does not change. Could somebody help?
The issue is that it is that you have to type the home directory as /home/username
, ie ~
will not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.