1 | initial version |
To build GMP statically for MSVC on Windows, follow these steps:
Download the latest GMP source code from https://gmplib.org/.
Extract the source code to a directory.
Open a MSVC command prompt.
Navigate to the directory where the GMP source code is located.
Configure the GMP build by running the following commands:
cd build
..\configure --disable-shared --enable-static --prefix=<install_directory>
<install_directory>
should be replaced with the directory where you want GMP to be installed.
Build GMP by running the following command:
nmake
Install GMP by running the following command:
nmake install
This will install GMP into the specified directory.
To use GMP in your MSVC project, add the GMP include directory to your project's include path, and link against the GMP static library (libgmp.lib) located in the <install_directory>\lib
directory.
Note: Make sure to use a compatible version of MSVC with the version of GMP you are building. Also make sure to set the appropriate architecture (32-bit or 64-bit) in the MSVC command prompt before building.