How to Install a C++ library on Windows for Dev-C++

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 09:02:00

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:

  1. 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;
}
  1. Unpack archive
  2. Copy gmp.h header into Dev-Cpp\MinGW64\x86_64-w64-mingw32\include
  3. Copy libgmp.dll.a into MinGW64\x86_64-w64-mingw32\lib
  4. Copy libgmp-10.dll shared library into Dev-Cpp\MinGW64\bin
  5. Edit properties of your project, add -lgmp flag into Linker (look for Parameters tab)
  6. 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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!