Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To build GMP statically for MSVC on Windows, follow these steps:

  1. Download the latest GMP source code from https://gmplib.org/.

  2. Extract the source code to a directory.

  3. Open a MSVC command prompt.

  4. Navigate to the directory where the GMP source code is located.

  5. 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.

  6. Build GMP by running the following command:

    nmake
    
  7. Install GMP by running the following command:

    nmake install
    

    This will install GMP into the specified directory.

  8. 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.