将 GMP 链接到 Xcode 4.5 [英] Linking GMP to Xcode 4.5

查看:18
本文介绍了将 GMP 链接到 Xcode 4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了 GMP 多精度库,并且我通过终端使用 gcc main.c -lgmp 命令编译了以下代码,但我不知道如何包含 gcc main.c -lgmpXCode 4.5 中的code>GMP 库,因为网上的howtos 有点混乱.

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.

我真的需要在我的项目中使用 GMP 库,任何评论都会有很大帮助.

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!
");
    mpz_t a;
    return 0;
}

推荐答案

(在问题编辑中回答.转换为社区 wiki 答案.参见 当问题的答案被添加到问题时,什么是适当的操作自己? )

(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? )

OP 写道:

已解决

1) 打开左侧面板,转到项目名称"、目标、构建阶段、将二进制文件与库链接,然后选择您的库.

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

2) 打开左侧面板,转到"ProjectName", Project, Header Search Paths, 写下您的库的标题所在的路径(.h 文件,通常在/usr/local/include).

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) 打开左侧面板,转到 ProjectName"、Project、Library Search Paths, 写下您的库所在的路径(.a.dylib 文件,通常在 /usr/local/lib)

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)

这篇关于将 GMP 链接到 Xcode 4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆