简体   繁体   English

brew installed gcc 找不到 brew installed gmp

[英]brew installed gcc can't find brew installed gmp

I used brew install gcc, and brew install gmp.我使用了 brew install gcc 和 brew install gmp。 However clang could compiler with option "-lgmpxx" and succeed while g++ failed I used this command:但是 clang 可以使用选项“-lgmpxx”编译并成功,而 g++ 失败我使用了这个命令:

g++ bn_p.cpp -o bn_p.out -lgmpxx -lgmp -Xpreprocessor -fopenmp

And it said:它说:

fatal error: gmpxx.h: No such file or directory
4 | #include <gmpxx.h>

Installing using home-brew doesn't seem the right approach, I suggest following the instruction of another answer which seems to follow some kind of best practice使用自制软件安装似乎不是正确的方法,我建议按照另一个似乎遵循某种最佳实践的答案的说明进行操作

If you still prefer to use your installation using brew, I resolved my problem by running如果您仍然喜欢使用 brew 安装,我通过运行解决了我的问题

brew info gmp

which returns the installation path, for example mine was:它返回安装路径,例如我的是:

/opt/homebrew/Cellar/gmp/6.2.1_1

then you just need to include the include folder as a library search path in your compilation command, for example:那么你只需要在你的编译命令中包含 include 文件夹作为库搜索路径,例如:

g++ main.cpp -o app -I /opt/homebrew/Cellar/gmp/6.2.1_1/include

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jenv 在 MacOS 上找不到通过 brew 安装的 java 17 - jenv can't find java 17 installed through the brew on MacOS 通过 brew 安装了 mysql 但终端找不到它。 在 macos 上别名的正确方法是什么? - Installed mysql via brew but terminal can't find it. What's the proper way to alias it on a macos? 在MacOS上使用Brew安装Octave 4.2.1; 无法让它与GUI一起运行 - Installed Octave 4.2.1 with brew on MacOS; can't get it to run with a GUI 节点:找不到模块(用 brew 安装的节点) - node: Cannot find module (node installed with brew) 尽管Brew已经安装,但它无法找到依赖关系 - Brew is not able to find dependency in spite of it being installed 无法安装ZMQ php扩展名。 找不到libzmq安装。 但是它是通过“ brew install zmq”安装的。 MacOS Mojave - Can't install ZMQ php extension. Unable to find libzmq installation. But it installed via “brew install zmq”. MacOS Mojave 包括 brew 安装的库到 XCode - Including brew installed library to XCode 如何使用brew安装的php? - How to use the php that brew installed? 如何修复 brew 安装的 MariaDB,它挂在 `mysql.server stop` 上并且没有停止? - How can I fix brew-installed MariaDB that hangs on `mysql.server stop` and doesn’t stop? 无法让RQuantLib在osx 10.9.4下使用brew安装的quantlib - Can't get RQuantLib working with brew installed quantlib under osx 10.9.4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM