I downloaded a library called GMP
(it's for doing calculations with arbitrarily large numbers) and I can't figure out how to actually install and use it. All of the instructions I find tell me to run the files configure
, MakeFile
, and install
, but when I try to do that I get 'install' is not a recognized internal or external command.
All I can figure is that the instructions are for Linux, but I'm running Windows. I found a couple of instructions here on SO that tell me to copy certain files into the Dev-C++ folder, but I can't find the files specified. I've never had to install a library like this before, so I'm really lost.f
If you have latest version of Dev-C++, that ships with MinGW-w64 (as its native environment), then you may download pre-builded package of GMP from here. After that all you have to do is:
- Create simple C++ console project.
Here is some basic main.cpp
file:
#include <cstdio>
#include <gmp.h>
int main(int argc, char** argv) {
mpz_t n;
mpz_init_set_str(n, "1234567890", 0);
gmp_printf("%Zd\n", n);
mpz_clear(n);
return 0;
}
- Unpack archive
- Copy
gmp.h
header intoDev-Cpp\MinGW64\x86_64-w64-mingw32\include
- Copy
libgmp.dll.a
intoMinGW64\x86_64-w64-mingw32\lib
- Copy
libgmp-10.dll
shared library intoDev-Cpp\MinGW64\bin
- Edit properties of your project, add
-lgmp
flag into Linker (look for Parameters tab) - Compile & Run
If you want other version or C++ interface, then you need to find existing build or try to compile it under MinGW environment.
来源:https://stackoverflow.com/questions/27620580/how-to-install-a-c-library-on-windows-for-dev-c