Search code examples
c++omnet++networkit

How to use NetworKit as a library in OMNeT++?


I am trying to build the C++ Core of NetworKit and I would like to use it as a library in OMNeT++. I followed the instructions from the README file to build the code with cmake and make all. Then, I tried to follow the instructions from the Use NetworKit as a library section, but the examples presented there are not consistent with the source code. In particular, the directory NetworKit/graph does not contain the Graph.h file. There is a Graph.hpp file, but in another directory. Also, the LibDemo.cpp file is missing. Is the README file outdated or I am missing something here?

EDIT
This is an update to my post above. Apparently the README file is not up to date. In any case, I built the C++ Core of NetworKit. I included the library in my OMNeT++ application as follows:
#include <graph/Graph.hpp>
In OMNeT++, in my project Properties | OMNeT++ | Makemake, and then selecting src | Options | Custom, I added the following:

INCLUDE_PATH += -I/path/to/networkit/include/networkit
LIBS += -L/path/to/networkit/build_lib -lnetworkit

When I build my OMNeT++ project, I get the following error:

/path/to/networkit/include/networkit/graph/../Globals.hpp:42:14: error: expected unqualified-id 
const double PI = 2.0*std::acos(0);
             ^
/path/to/omnetpp-5.4.1/include/omnetpp/simkerneldefs.h:47:19: note: expanded from macro 'PI'
#define PI        3.141592653589793
                  ^

Can anyone help me with this? Thank you in advance!


Solution

  • You're correct, the documentation is out of date, LibDemo.cpp was deleted here: https://github.com/kit-parco/networkit/commit/a5b2c1f0c9336e783c8fb0cd956326d960451914

    If you want an older version where this part of the doc is still valid, that would be version 4.2 which is the last version with this file. Somebody made a clone of that version here for some reason: https://github.com/SharafMohamed/NetworKit