Linking GMP to Xcode 4.5

空扰寡人 提交于 2019-12-29 09:39:08

问题


I've downloaded the GMP multiprecision library and I compiled without errors the following code through the terminal with the gcc main.c -lgmp command but I can't figure out how to include the GMP library in XCode 4.5 because the howtos online are a bit confusing.

I really need to use the GMP library for my projects and any comment would be great help.

#include <stdio.h>
#include <gmp.h>

int main(int argc, const char * argv[])
{
    printf("Hello, World!\n");
    mpz_t a;
    return 0;
}

回答1:


(Answered in a question edit. Converted to a community wiki answer. See What is the appropriate action when the answer to a question is added to the question itself? )

The OP wrote:

SOLVED

1) Open the left panel, goto "ProjectName", Targets, Build phases, Link binary with libraries and select your library.

2) Open the left panel, goto "ProjectName", Project, Header Search Paths, write the path where the headers of your library are (the .h files, usually in /usr/local/include).

3) Open the left panel, goto "ProjectName", Project, Library Search Paths, write the path where your libraries are (the .a or .dylib files, usually in /usr/local/lib)



来源:https://stackoverflow.com/questions/13955996/linking-gmp-to-xcode-4-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!