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