【问题标题】:boost .h file not found while trying to install a library尝试安装库时找不到 boost .h 文件
【发布时间】:2015-10-03 03:59:29
【问题描述】:

根据https://github.com/shaih/HElib/blob/master/INSTALL.txt,我正在尝试在 OSX 中安装 C++ 库 (HElib)。 当我使用make 命令时,它说fatal error: 'tr1/memory' file not found:

g++ -g -O2  -c NumbTh.cpp
In file included from NumbTh.cpp:16:
./NumbTh.h:71:10: fatal error: 'tr1/memory' file not found

我安装了 boost 库(使用自制软件),它位于 /usr/local/include 并包含该确切文件,但每次仍然会出现该错误。 我能做什么?

【问题讨论】:

  • 你能把文件 NumbTh.h 的内容贴在第 67 行和第 75 行之间吗?
  • #if (__cplusplus>199711L) #include #include #else #include #include using namespace tr1; #endif
  • 我查看了安装说明,并没有提到 boost。我认为这与这里无关。此链接 (tinyurl.com/nkq56hw) 可能很有用。另外你使用的是哪个编译器?你可以输入 g++ -version

标签: c++ macos boost terminal


【解决方案1】:

如果您查看line 71,您会看到它正在对__cplusplus 进行版本测试。由于版本测试失败,它决定你有一个旧的编译器,需要包含 <tr1/memory> 而不是 <memory> 以获得一些标准功能。 (很可能是 shared_ptrunique_ptr,以前只在 TR1 标头中可用。)

因此,您要么需要修补 HElib 为编译器做正确的事情,要么将编译器更新到支持 <tr1/memory> 的版本或直接支持 <memory> 的现代版本。

另请参阅documentation for __cplusplus

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-25
    • 2021-08-07
    • 2010-09-12
    • 2017-04-05
    • 1970-01-01
    • 2011-02-13
    • 2016-04-14
    相关资源
    最近更新 更多