GLPK/Windows

This page explains how to compile GLPK from source for a Windows operating system. And, should you wish, how to link to the resulting DLL runtime library. Remember to consult your compiler documentation if you encounter difficulties.

Precompiled option: as an alternative, GLPK is also available as precompiled Windows executables. This is clearly more convenient than compiling from scratch. However a manual build allows you to customize your build configuration so that the resulting library can better match your circumstances and needs.

Microsoft Visual C++ (MSVC) compiler
The following packages are needed:


 * Microsoft Visual C++ 2010 Express
 * Microsoft Windows SDK
 * WinZip, 7-Zip, or another decompression utility, to extract gzip and tar files

Visual Studio 2010 Service Pack 1 (SP1) deletes the SDK 64-bit compiler. To install the 64-bit compiler proceed as follows:
 * install Visual-CPP Microsoft Visual C++ 2010 Express.
 * install Microsoft Windows SDK for Windows 7 and .NET Framework 4 without "Visual C++ Compilers".
 * install Visual Studio 2010 Service Pack 1 (SP1)
 * install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1

Check if file C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\vcvars64.bat exists. If not create it with the following content: CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64

Download the source distribution from ftp://ftp.gnu.org/gnu/glpk/ or from one of the GNU mirrors. Extract the archive using WinZip or similar.

A batch file is used to build GLPK and batch files for different versions of Windows are provided. Users of 64-bit Windows should navigate to the w64 subdirectory, while users of 32-bit Windows should navigate to the w32 subdirectory.

The batch file named Build_GLPK_with_VC10.bat builds GLPK as a static library, whereas the batch file named <tt>Build_GLPK_with_VC10_DLL.bat</tt> builds GLPK as a dynamic link library. It is normally preferable to build the dynamic link library.

In the batch file <tt>Build_GLPK_with_VC10_DLL.bat</tt>, the following line specifies where Visual C++ is installed: set HOME="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"

If necessary, adjust this path by editing the file. The Notepad editor is present on all Windows systems.

You can start the build process by double clicking the batch file from Windows File Explorer. Or you may use a command shell by selecting <tt>Run</tt> the start menu, typing  into the dialog box, and hitting "OK". In which case, first navigate to the path in which you extracted GLPK &mdash; in this example, we assume <tt>C:\temp</tt>, GLPK 4.45, and 64-bit Windows:

> cd C:\temp\glpk-4.45\w64

Then execute the required build script &mdash; after making any necessary modifications (see above). For the dynamic link library, invoke:

> Build_GLPK_with_VC10_DLL.bat

For the static library, invoke  instead.

The batch file also runs a test model. Make sure that the following message appears in the console window, toward the end:

OPTIMAL SOLUTION FOUND

Visual Studio project
A Visual Studio project can also be easily built, but you will need to:


 * provide the location of <tt>glpk.h</tt>
 * include the two GLPK source subdirectories <tt>src/amd</tt> and <tt>src/colamd</tt>

Windows CE
Windows CE is Microsoft's embedded operating system.

To build a package for Windows CE 6 will require VisualStudio 2005 and Platform Builder. You first build a customized BSP, then an OS Design, and then an SDK for the OS Design. It may better to do all this as a static library and then download the resulting file to your Windows CE device.

You will also need to give the location of <tt>glpk.h</tt> and include the GLPK <tt>src/amd</tt> and <tt>src/colamd</tt> directories within the sub-project for your current OS Design.

Also check this June 2011 thread for more details.

Borland C++ compiler
Development of the free Borland C++ 5.5 compiler ceased several years ago, but it is still available at edn.embarcadero.com/article/20633.

Build scripts for the Borland C++ compiler were included in GLPK up to version 4.37 and dropped thereafter.

GNU GCC (via MinGW) compiler
MinGW (Minimalist GNU for Windows) is a port of the GNU Compiler Collection (GCC) and Binutils to enable the development of native Microsoft Windows applications on Windows itself.

Build scripts for MinGW were included in GLPK up to version 4.37 and dropped thereafter.

In the MSYS (Minimal SYStem) environment, GLPK can be built using the appropriate POSIX makefile.

GNU GCC (via Cygwin) compiler
Cygwin is a Unix-like environment and command-line interface for Microsoft Windows.

In the Cygwin environment, GLPK can be built using the appropriate POSIX makefile.

Dev-C++
Dev-C++ is Microsoft Windows IDE that fronts the GNU GCC compiler. As of 2011, Dev-C++ is not under active development, although the spin-off project wxDev-C++ is. GLPK used to provide a makefile for Dev-C++ but no longer does. If you need an alternative, consider using Microsoft Visual Studio Express.