开发者

gmpxx.h: no such file or directory

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 " <&开发者_如何学编程lt; abs(c) << "\n";

  return 0;
}

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 header file is included in the libgmp-dev package

You can install it on Ubuntu based machines with this command:

$ sudo apt-get install libgmp-dev


If you are building gmp from source, you need to add the --enable-cxx flag to the configure command.


You can also copy that to the path"/usr/include/", the system will find it.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜