【问题标题】:no such file or directory boost python没有这样的文件或目录提升 python
【发布时间】:2018-03-19 05:26:29
【问题描述】:

我正在从 Boost.Python 页面运行hello world example

但是我收到了错误消息

Cannot open include file: 'boost/python/detail/prefix.hpp': No such file or directory

我的 CMD 命令只是 bjam

C:\Program Files\boost_1_66_0\boost\ is in PATH 和 prefix.hpp 在C:\Program Files\boost_1_66_0\boost\python\detail\prefix.hpp

hello.cpp如下:

"#include "C:\Program Files\boost_1_66_0\boost\python\module.hpp"
#include "C:\Program Files\boost_1_66_0\boost\python\def.hpp"
#include "C:\Program Files\boost_1_66_0\boost\python\detail\prefix.hpp"


char const* greet()
{
   return "hello, world";
}

BOOST_PYTHON_MODULE(hello_ext)
{
    using namespace boost::python;
    def("greet", greet);
}

【问题讨论】:

    标签: python c++ boost


    【解决方案1】:

    错误“无法打开包含文件”表示编译器试图打开文件boost/python/detail/prefix.hpp,但找不到。

    这意味着你必须告诉它去哪里看。编译器在其中查找包含文件的目录列表称为“包含路径”。虽然我知道这听起来像PATH,但它不一样。 PATH 用于搜索从 shell 运行的可执行文件,而不是用于查找头文件的位置。

    您使用的是什么编译器?命令bjam 是调用Boost 构建系统,除非你使用Cygwin 来构建,否则这个is not supported

    尝试按照 Boost.Python 设置页面上的说明进行操作,例如 no-install quickstart,因为它们会引导您调试多种类型的构建错误。

    【讨论】:

    • 谢谢。我尝试使用 bjam 和 g++ 来运行它。我会看看你引用的方向。
    猜你喜欢
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-17
    相关资源
    最近更新 更多