Gmpxx.h: no such file or directory

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

Then I wrote down this simple example to check if it would 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; } 

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

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

Does anyone have a hint? I do not know what to do...

+2
source share
3 answers

You need to make sure that it is among the directories that searched for the headers. Locate the gmpxx.h header and add -I /path/to/header/ to the g++ line.

+2
source

gmpxx.h header file included in libgmp-dev package

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

 $ sudo apt-get install libgmp-dev 
+8
source

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

+4
source

Source: https://habr.com/ru/post/896264/


All Articles