0

I used brew install gcc, and brew install gmp. However clang could compiler with option "-lgmpxx" and succeed while g++ failed I used this command:

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>
Zijie Han
  • 29
  • 5

1 Answers1

0

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 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:

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