Link the gmp library with Xcode 7.2

2019-09-04 12:52发布

问题:

I try to link the gmp library with Xcode. This is what I (with the help of multiple stackoverflow articles) did:

  1. I downloaded the gmp file and installed it (in the default location: /usr/local ) using "sudo make install" and I checked it with "make check".
  2. In Xcode I added under "Other Linker Flags" (as described in multiple articles) -lgmp. I also tried -lgmpxx.
  3. In main I included <stdio.h> and <gmp.h>.

After all I still got the error: " 'gmp.h' file not found ", which indicates that the library is not properly linked. I don't see what I am doing wrong. Suggestions would be appreciated. Thanks in advance!

回答1:

To get C++ support, you need to run

 ./configure --enable-cxx

plus any other desired/required options, see https://gmplib.org/manual/Build-Options.html, before running

make install