【问题标题】:Boost compilation error with python使用python提升编译错误
【发布时间】:2012-07-21 00:32:27
【问题描述】:

我是 boost C++ 库的新手,我正在尝试将 boost 与 python 一起使用。每当我编译我的简单测试程序时,都会出现错误:

error: pyconfig.h: No such file or dirctory 

(后面还有一千多个错误,我敢肯定这是因为缺少标题)。 我从它的网站下载了 boost,然后建立了这个库。我仍然不知道为什么该文件丢失以及如何获取它。请帮忙!

我正在使用 code::blocks MinGW 编译器,并且我已将代码块指向 boost 文件夹,作为头文件和库的搜索目录。 这是我的简单程序:

#include <boost/python.hpp>

using namespace boost::python;

int main()
{
    Py_Initialize();
    PyRun_SimpleString("from time import time,ctime\n"
                        "print ’Today is’,ctime(time())\n");
    Py_Finalize();
    return 0;
}

【问题讨论】:

    标签: c++ python boost embed


    【解决方案1】:

    您的包含路径中显然没有 CPython 标头。仅拥有boost::python 是不够的,您还需要 Python 本身。

    【讨论】:

    • 感谢 ThiefMaster,我确实安装了 python,只是没有将 code::blocks 指向它的包含目录。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-31
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 2012-09-23
    相关资源
    最近更新 更多