Xcode 6.0.1版gmp.h头文件找不到,尽管gmp.h和gmpxx.h在local/include中

Xcode Version 6.0.1 gmp.h header file not found, even though gmp.h and gmpxx.h are in local/include

本文关键字:gmp gmpxx local 尽管 include 找不到 1版 Xcode 文件      更新时间:2023-10-16

我正在尝试让GMP与Xcode一起工作。到目前为止,我已经解开了主目录中的文件,运行了所有必要的命令来配置、制作和安装

./configure --prefix=/usr/local --enable-cxx
make
make check
sudo make install

gmp.h和gmpxx.h都在/usr/local/include中,但是我在尝试包含这些文件时仍然会遇到错误。我认为我需要添加一个complexer标志,但对于这个版本的Xcode,我不知道如何做到这一点。如果不是这样的话,我需要做一些其他的事情,请提供建议,我将非常感谢

我的代码如下所示:

#include <iostream>
#include <gmp.h>
int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!n";
    return 0;
}

我可以用c++中的GMP进行编码吗?还是我需要c中的代码?如果能为您提供任何帮助,我们将不胜感激,提前感谢!

很抱歉,如果这看起来像是一个重复的问题,我确实看了其他问题,但我无法按照之前问题的答案进行操作。

更新

将libgmp.la和libgmpxx.la添加到Xcode中,还将/usr/local/include添加到头文件搜索中,但它仍然不起作用!我在我的项目中看到了库文件,如果我放"gmp.h"而不是它有效,但当我使用gmp时,它无法告诉我将其他gmp文件更改为"gmp.h",这似乎是不对的。

有什么想法吗?

this is the fix according to another SO question:
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)