Installing & Finding GMP under OSX

By the way, the easiest way to install gmp on a Mac is by using homebrew. You go to the homebrew website and copy the one-line installation script and paste it into Terminal. Then you can find any package you want like this:

brew search gmp

and install very simply with

brew install gmp

Anyway, back to your actual question... I suspect you have not set the Header search path correctly in Xcode.

First, you need to find where gmp.h is located, so do this in Terminal:

find /usr /opt -name "gmp.h"

I am guessing here that it is under /usr or /opt, but if you know you installed gmp elsewhere, replace /usr /opt with that place.

Sample Output

/usr/local/Cellar/gmp/include/gmp.h

That will tell you where it is located, then take the containing directory (i.e. the answer above MINUS the "gmp.h" bit at the end) and add it into Xcode Build Settings in the area marked in blue on the diagram. To get to the blue area, click first on the area marked in green, then yellow, then blue.

enter image description here

Tags:

C++

Macos