【问题标题】:Installing Armadillo on macOS with homebrew使用自制软件在 macOS 上安装犰狳
【发布时间】:2021-12-06 16:51:32
【问题描述】:

我正在尝试使用 Homebrew 安装犰狳

brew install armadillo

但是当我尝试编译时

g++ example.cpp -o example -std=c++11 -O2 -larmadillo

它给出了以下错误:

fatal error: 'armadillo' file not found

我该如何解决这个问题?

【问题讨论】:

  • 请在您的问题中包含完整错误消息。

标签: c++ c++11 armadillo


【解决方案1】:

我猜你有一台新的 M1 Mac。在这种情况下,问题是 ARM-native homebrew 默认安装到 /opt/homebrew/,这意味着犰狳安装到 /opt/homebrew/include/ 中,这不在您的搜索路径中。

要查看是否是这种情况,请尝试提供如下路径:

CPATH=/opt/homebrew/include LIBRARY_PATH=/opt/homebrew/lib g++ example.cpp -o example -std=c++11 -O2 -larmadillo

为了避免一般问题,我正在使用在我的~/.zprofile 文件中导出的那些 CPATH 和 LIBRARY_PATH 变量(使用zsh)运行。我发现this answer on the apple stack exchange 很有帮助。

【讨论】:

    猜你喜欢
    • 2012-04-27
    • 1970-01-01
    • 2017-11-16
    • 1970-01-01
    • 2020-05-25
    • 2017-03-07
    • 2021-05-05
    • 1970-01-01
    • 2021-09-26
    相关资源
    最近更新 更多