Building OpenNN

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. If you want to work with another compiler, you need to create a project for it. In this tutorial, you'll learn how to do that.


Visual Studio

In order to use OpenNN with Visual Studio a solution for it must be created. This is easily done using Cmake. First of all, you can download OpenNN from GitHub or Sourceforge. Then, open a terminal, go to your OpenNN folder and run the following command.

cmake .

The necessary files for a Visual Studio solution will be created in the directory.

Please mind the following dependencies:

Execute the file opennn.sln, and build opennn first, selecting Release as the build type. Now, you can run the example applications, each located in its respective folder and the .exe file in a Release directory. A MS-DOS console should appear with the results of the corresponding example.

Iris plant example.

Once you have seen OpenNN work, you can develop your own neural networks application. In order to do that, use the blank example.

Blank project.


The process for building OpenNN using Make is really simple. Got to your OpenNN folder and run the following code to generate the necessary MakeFiles:

cmake -DCMAKE_TYPE_BUILD=Release .

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.

Now Simply run:


All necessary files will be built and OpenNN will be ready to use. If you want to make only certain parts of the whole OpenNN repository you can do so by passing some argument to the above command (E.g: make opennn, make tests, ...). Please mind the following dependencies:

Once all the makefiles had been created, you can run the example applications and create your own neural networks program. Take note that the executable files must be moved to a folder inside its current directory (E.g: path_to_example_folder/example_file must be moved to path_to_example_folder/Release/example_file).

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. Run an example.
  3. Create your application.

1. Download Qt

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

2. Run an example

The project file for Qt Creator can be found in the opennn folder. To start 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 OpenNN. Iris plant example.

3. 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. Blank project.