In your Xcode project, you need to configure a few things. For example, I have gmp installed in /opt/gmp/5.0.2 , and I will use this as an example. The actual library is installed in /opt/gmp/5.0.2/lib and the header files in /opt/gmp/5.0.2/include . When you install the library installation, the -PREFIX flag in /opt/gmp/5.0.2 will handle this automatically. If you do not set this flag, the prefix is usually set to /usr/local by default.
- Other linker flags look correct, this should be the name of the library.
- Set the header search path to the include directory, in my case
/opt/gmp/5.0.2/include . - Set the library search path in the lib directory, in my case
/opt/gmp/5.0.2/lib .
Since the header search path is set, you should now include the header file as follows:
#include <gmp.h>
Of course, replace /opt/gmp/5.0.2 with the PREFIX path that you used when installing gmp.
Finally, you usually do not install libraries on /usr/local/bin , you must install on /usr/local and allow any binaries to be installed in bin, while libraries like these will be installed in lib. Of course, any route scheme will work, I usually recommend /opt/<project-name>/<version-number> , because it allows me to better track what I installed and have several versions of the same libraries and tools without dealing with conflicts.
source share