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
- NLopt.v2.6.2.i686-w64-mingw32.tar.gz (32-bit)
- NLopt.v2.6.2.x86_64-w64-mingw32.tar.gz (64-bit)
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).
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.)
- First, download the
.dlland import library (.dll.a) from above. - Download
nlopt_optimize-oct.ccand put it in the same directory as the.dlland.dll.afiles. - Compile the Octave plugin (
.octfile) withmkoctfile -lnlopt --output nlopt_optimize.oct nlopt_optimize-oct.cc(mkoctfileis a program included with Octave). - Finally, move
libnlopt.dllto the octave`bindirectory (the location ofoctave.exe) so that Octave can find it.