我正在运行 Pop!_OS(ubuntu 衍生产品)并从默认存储库中安装了 boost(libboost-all-dev)。我知道它已正确安装,因为我可以使用 GCC 编译和运行简单的 boost odeint 示例。
但是,当我尝试使用 zeus-cling 内核在 jupyter 笔记本中运行相同的示例时,在包含 odeint 标头时出现错误。我可以在执行此代码时重新创建错误:
#pragma cling add_include_path("/usr/include")
#include <boost/numeric/odeint.hpp>
我得到的错误信息是:
In file included from input_line_8:1:
In file included from /usr/include/boost/numeric/odeint.hpp:22:
In file included from /usr/include/boost/numeric/odeint/config.hpp:44:
In file included from /usr/include/boost/config.hpp:48:
In file included from /usr/include/boost/config/stdlib/libstdcpp3.hpp:78:
/usr/include/unistd.h:756:28: error: expected function body after function declarator
extern __pid_t fork (void) __THROWNL;
^
/usr/include/unistd.h:869:11: fatal error: 'bits/getopt_posix.h' file not found
# include <bits/getopt_posix.h>
^~~~~~~~~~~~~~~~~~~~~
Interpreter Error:
据我了解bits/getopt_posix.h
,只有 GCC 标头,因此我认为问题可能是因为 boost 标头正在配置自己,就好像它们在 GCC 下编译而不是 cling/clang 一样。
那么,如何在 xeus-cling jupyter 笔记本中正确包含 boost?