How to install Windows C ++ library for Dev-C ++

I downloaded a library called GMP

(it is for doing calculations on arbitrarily large numbers) and I cannot figure out how to install and use it. All the instructions I find tell me to run files configure

, MakeFile

and install

, but when I try to do this, I get'install' is not a recognized internal or external command.

All I can understand are instructions for Linux, but I am running Windows. I found some instructions here that show you how to copy certain files to the Dev-C ++ folder, but I can't find the files mentioned. I've never had to install a library like this before, so I really lost the .f

+3


source to share


1 answer


If you have the latest Dev-C ++ that comes with MinGW-w64 (as its native environment), you can download the finished GMP package from. After that, all you have to do is:

  • Create a simple C ++ console project.

Here's the base 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;
}

      

  1. Unpack archive
  2. Copy title gmp.h

    toDev-Cpp\MinGW64\x86_64-w64-mingw32\include

  3. Copy libgmp.dll.a

    toMinGW64\x86_64-w64-mingw32\lib

  4. Copy libgmp-10.dll

    shared library toDev-Cpp\MinGW64\bin

  5. Edit the properties of your project, add a flag -lgmp

    to the linker (find the Options tab).
  6. Compile and run

If you want to use a different version or C ++ interface, you need to find an existing assembly or try to compile it in the MinGW environment.

+1


source







All Articles