1. Coding



Project Euler


@see Proficiency

Without mistakes

C++ Unit Testing Tutorial

Good practices

cppbestpractices – GitBook

Coding style

GCC Coding Conventions
Google C++ Style Guide











#include “mlpack\core.hpp”

Using mlpack in other applications under Visual Studio 2015

If you want to write your own application and link mlpack against it, you will need to add the include directories of mlpack to your project and add mlpack.lib to the libraries you link against.

Let’s do it accordingly to Once again… guide.


First of all OpenBLAS libraries should be copied to C:/Windows/System32/ and those are:




And also libopenblas.dll.a from:


Warning: This is of course optional, but it’s easier later to include each one as Additional Dependency

1. Create New Project

Let’s create new project and paste example code from mlpack tutorials mlpack Input and Output


Warning1: Remember to change Solution Configuration to Debug/Release & Solution Platform to x64/x86 – it’s dependent from how mlpack & armadillo was compiled.

Warning2: Don’t forget to include #include “stdafx.h” & #include <iostream> or just copy this snippet:

#include "stdafx.h"
#include <iostream>

#include "mlpack\core.hpp"

int main(int argc, char** argv)
	//pass main's arguments..
	mlpack::CLI::ParseCommandLine(argc, argv);

	//some_timer starts ticking..

	//some outputs..
	mlpack::Log::Debug << "Compiled with debugging symbols." << std::endl;
	mlpack::Log::Info << "Some test informational output." << std::endl;
	mlpack::Log::Warn << "A warning!" << std::endl;

	//better comment it or..
	//mlpack::Log::Fatal << "Program has crashed." << std::endl;
	mlpack::Log::Warn << "Made it!" << std::endl;

	//some_timer stops..

	return 0;

2. Compiler Additional Include Directories

Go to Project > Properties > C/C++ > General and add mlpack, armadillo and boost include directories:



3. Compiler Additional Library Directories

Create following folder:


and copy there all files listed below:

mlpack.lib/dll (depends on how mlpack and armadillo target was compiled)
armadillo.lib/dll (same as above)

* - whole folder

Go to Project > Properties > Linker > General and add C:/projects/libs


4. Linker Additional Dependencies

Go to Project > Properties > Linker > Input and add C:/libraries/mlpack.lib


Warning: Additional Dependencies (mlpack.lib or mlpack.dll) should point to the same .lib/.dll from Additional Library Directories (C:/libraries/mlpack.lib or C:/libraries/mlpack.dll)

5. Compile & Run

Output should be:

[WARN ] A warning!
[WARN ] Made it!
Press any key to continue . . .


or in verbose mode with -v as input argument for application:

[INFO ] Some test informational output.
[WARN ] A warning!
[WARN ] Made it!
[INFO ] Execution parameters:
[INFO ]   help: false
[INFO ]   info: ""
[INFO ]   verbose: true
[INFO ]   version: false
[INFO ] Program timers:
[INFO ]   some_timer: 0.002928s
[INFO ]   total_time: 0.004584s
Press any key to continue . . .


This can be done by going to Project > Properties > Debugging and setting Command Arguments: -v



  • Prepare weekly challenge
  • Maximize Japanese lessons
  • Finish story with mlpack::backtrace under Windows

Once again…

Yup, once again I’m installing Windows.

There are some people who sometimes are tempted to go for shopping or have some fun at the club, but me… I like from time to time to change the operating system [wat?]. I get the impression then that my computer has been cleared from all of the errors and failures which I did with his previous incarnation.

Okay, seriously, I wanted to finally compile MLPACK under Windows. According to the keonkim's guidelines, it went like clockwork.

========== Build: 40 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

In case I forgot how it was doing:

    1. Configurate MLPACK in Visual Studio 2015 Community:
      • create new project: File > New > Project from Existing Code
      • install dependencies: Tools > NuGet Package Manager > Manage NuGet Packages for Solution > Browse
        • OpenBLAS.
        • boost.1.61.0
        • boost_unit_test_framework-vc140.1.61.0
        • boost_program_options-vc140.1.61.0
        • boost_random-vc140.1.61.0
        • boost_serialization-vc140.1.61.0
        • boost_math_c99-vc11.0
    2. Build latest stable Armadillo
cmake -G "Visual Studio 14 2015 Win64"- BLAS_LIBRARY:FILEPATH="C:/projects/mlpack-2.0.3/packages/OpenBLAS." -DLAPACK_LIBRARY:FILEPATH="C:/projects/mlpack-2.0.3/packages/OpenBLAS." -DCMAKE_PREFIX:FILEPATH="C:/projects/armadillo" -DBUILD_SHARED_LIBS=OFF ..

 3. Build latest stable MLPACK

cmake -G "Visual Studio 14 2015 Win64" -DBLAS_LIBRARY:FILEPATH="C:/projects/mlpack-2.0.3/packages/OpenBLAS." -DLAPACK_LIBRARY:FILEPATH="C:/projects/mlpack-2.0.3/packages/OpenBLAS." -DARMADILLO_INCLUDE_DIR="C:/projects/armadillo-7.400.1/include" -DARMADILLO_LIBRARY:FILEPATH="C:/projects/armadillo-7.400.1/build/Debug/armadillo.lib" -DBOOST_INCLUDEDIR:PATH="C:/projects/mlpack-2.0.3/packages/boost." -DBOOST_LIBRARYDIR:PATH="C:/projects/mlpack-2.0.3/packages/boost_libs" -DDEBUG=ON -DPROFILE=OFF ..