Building OpenNN

Roberto Lopez.
Artelnics - Making intelligent use of data

OpenNN has been written in ANSI C++. This means that the library can be built on any system with little effort. OpenNN includes project files for Qt Creator. When working with another compiler is needed, a project for it must be created. In this tutorial, you'll learn how to do that.


  1. Qt Creator
  2. CMake
  3. Visual C++
  4. Make

1. Qt Creator

Qt Creator is a cross-platform IDE (integrated development environment). That means that it can be used in Windows, Linux and MacOS. Note that OpenNN does not use the Qt library. In order to run OpenNN with Qt creator, follow the next steps:
  1. Download Qt.
  2. Download OpenNN.
  3. Run an example.
  4. Create your application.

(i) Download Qt

The first step is to download Qt, it can be done from here.

(ii) Download OpenNN

The second step is also to download OpenNN from Sourceforge or GitHub. OpenNN includes project files for Qt Creator. Nevertheless, the OpenNN library does not make use of the Qt Library.

(iii) Run an example

The project file for Qt Creator can be found in the opennn folder. To open the OpenNN project just double click on that file.

Many example subprojects are also included in the OpenNN distribution. From the opennn project select some example, for instance the simple_function_regression subproject. Then run that example by clicking on the play button or pressing Ctrl+R. Read the application code to see what the simple function regression example does. The next figure shows the iris plant example.

Iris plant example.

(iv) Create your application

Now you can create a new project in a blank example, in order to use the tasks of OpenNN that better suit your needs.

Blank project.

2. CMake

OpenNN includes CMake files compatibles with MPI and OpenMP compilations. You just have to use "-D__OPENNN_MPI__=1" for the MPI compilation (requires mpi compiler), or "-D__OPENNN_OMP__=1" for the OpenMP compilation.

3. Visual C++

In order to use OpenNN with Visual C++ a solution for it must be created. Please mind the following dependencies:
  • The folder opennn contains the OpenNN source libray.
  • The folder eigen contains the Eigen template library, which is used by OpenNN.
  • The folder examples contains several applications which use OpenNN.
  • The folder tests contains another application which use OpenNN.

Once the solution has been created, you can run the example applications. A MS-DOS console should appear with the results of the corresponding example. To develop your own neural networks application, use the blank example.

4. Make

In order to compile OpenNN with Make, several makefiles need to be created. As before, please mind the following dependencies:
  • The OpenNN source library depends on the Eigen library.
  • All the examples depend on OpenNN.
  • The tests also depend on OpenNN.

Once all the makefiles has been created, you can run the example applications and create your own neural networks program.