[英]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.