NLopt on Windows

NLopt on Windows

NLopt works fine on Microsoft Windows computers, and you can compile it directly using the included CMake build scripts.

To simplify installation, there are also precompiled 32-bit and 64-bit Windows DLLs (along with binaries for many other systems) at NLoptBuilder/releases. In particular, the Windows builds are

These .tar.gz files unpack (with a variety of Windows software, e.g. 7-zip) into a folder with a bin subdirectory that contains libnlopt.dll. To link with this in your compiler, you will typically also want the import library for the DLL, which can be found in the lib subdirectory and is called libnlopt.dll.a (this can be used similarly to the .lib files you may be used to). See, in particular, these instructions for nlopt.

Unofficial Python binaries for Windows are available from Christoph Gohike:

NLopt with MinGW

If you want to compile NLopt on Windows with MinGW, be sure to install the MinGW version of cmake (e.g. with pacman -S mingw-w64-x86_64-cmake) and then build via cmake -G"MSYS Makefiles" . && make in order to ensure that cmake produces the correct type of makefile.

Octave plugin

To build the NLopt plugin for GNU Octave (a free Matlab clone, which uses the same NLopt interface as in Matlab), you will need the following additional steps. (See Octave for Windows on the Octave web page to download Octave.)

  1. First, download the .dll and import library (.dll.a) from above.
  2. Download and put it in the same directory as the .dll and .dll.a files.
  3. Compile the Octave plugin (.oct file) with mkoctfile -lnlopt --output nlopt_optimize.oct (mkoctfile is a program included with Octave).
  4. Finally, move libnlopt.dll to the octave`bin directory (the location of octave.exe) so that Octave can find it.