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.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-03-20 11:00:00 +0000
Seen: 22 times
Last updated: May 23 '22