November 3, 2012

HOWTO: Compile Shark Machine Learning Library on Windows using MinGW, CMake

Shark Machine Learning Library ( is a modular C++ library for the design and optimization of adaptive systems. It provides methods for linear and nonlinear optimization, in particular evolutionary and gradient-based algorithms, kernel-based learning algorithms and neural networks, and various other machine learning techniques. SHARK serves as a toolbox to support real world applications as well as research in different domains of computational intelligence and machine learning. The sources are compatible with the following platforms: Windows, Solaris, MacOS X, and Linux.

You can get source here: or thru SVN from here:

Here you can read how to compile Shark library, but installing and compiling Shark on Windows systems is not so clear for typical users. 

So, to compile, you must have installed this software:


When you unpack Shark sources, go to Shark root directory, and create file script.bat:

mkdir <path-to-build-dir>

cd <path-to-build-dir>

<path-to-CMake-bin>\cmake.exe -G"MinGW Makefiles" <path-to-Shark-sources>


For example, I unpacked Shark sources to d:\PROJECTS\NEURAL\Shark\, and there I created such script file:

mkdir d:\PROJECTS\NEURAL\Shark_bin

cd d:\PROJECTS\NEURAL\Shark_bin

"d:\WORKSHOP\CMake 2.8\bin\cmake.exe" -G"MinGW Makefiles" d:\PROJECTS\NEURAL\Shark\



Example of using Shark with Qt. In .pro file add:


CONFIG  = qt console



   LIBS = -L$${SHARKHOME}/lib/ -lshark




That's all!