gmpxx.h:没有这样的文件或目录

问题描述:

我刚刚安装了一个全新的mingw(32位)副本,从官方项目页面下载 from Sourceforge。我在程序包中安装了所有的东西,所有的编译器等等。然后我从这里下载了MinGW 。我将gmp-5.0.1-1-mingw32-src.tar.lzma提取到我的mingw文件夹,然后从那里运行 ./ pkgbuild 。它继续运行了几分钟,然后打印出像 COMPLETED一切OK,一切通过

I just installed a brand new copy of mingw (32 bit) downloading it from the official project page from Sourceforge. I installed everything in the package, all compilers and so on. Then I downloaded from here gmp for MinGW. I extracted gmp-5.0.1-1-mingw32-src.tar.lzma somewhere into my mingw folder, then ran ./pkgbuild from there. It went on running for some minutes, then printed out something like COMPLETED EVERYTHING OK, EVERYTHING PASS.

然后我写下这个简单的例子,检查它是否可以工作:

Then I wrote down this simple example, to check if it was going to work:

#include <gmpxx.h>

int main (void)
{
  mpz_class a, b, c;

  a = 1234;
  b = "-5678";
  c = a+b;
  cout << "sum is " << c << "\n";
  cout << "absolute value is " << abs(c) << "\n";

  return 0;
}

然后使用 g ++编译mycxxprog.cc - lgmpxx -lgmp
我得到的唯一答案是:

And then compiled it using g++ mycxxprog.cc -lgmpxx -lgmp. The only answer I get is:

Fatal error: gmpxx.h: No such file or directory.

有人有任何提示吗?我真的不知道该怎么做...

Does anybody have any hint? I don't really know what should I do...

您需要确保在搜索的目录标题。找到 gmpxx.h 标题所在的位置,并将 -I / path / to / header / 添加到 g ++ 行。

You need to make sure the is among the directories searched for headers. Find the place where the gmpxx.h header resides and add -I /path/to/header/ on your g++ line.