加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

在使用boost的c中你好世界python扩展?

发布时间:2020-05-23 13:44:27 所属栏目:Linux 来源:互联网
导读:这是我使用boost进行python扩展的第一次尝试.有人可以帮助我理解导致编译错误的原因吗? #include iostream using namespace std; void say_hello(const char* name) { cout Hello name lt

这是我使用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:
/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:
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

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读