这是我使用boost进行python扩展的第一次尝试.有人可以帮助我理解导致编译错误的原因吗?
#include
user @ host:〜$g main.cpp -o test.so
@H_403_13@
In file included from /usr/include/boost/python/detail/prefix.hpp:13:0,from /usr/include/boost/python/module.hpp:8,from main.cpp:8:
/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory compilation terminated.
最佳答案
@H_403_13@
/usr/include/boost/python/detail/wrap_python.hpp:50:23:
fatal error: pyconfig.h: No such file
or directory compilation terminated.
这一行告诉它为什么不起作用.您的编译器不知道pyconfig.h文件在哪里.你有两个选择:
>将pyconfig.h放在一个位置
g知道(即你的
项目目录)
>添加-I DIRECTORY(这是资本i,
不小写L)标志为g
将为头文件搜索DIRECTORY
g++ -I /path/to/my/include/files main.cpp