Build

Building KGraph Tools

A suite of tools is provided with the SDK. To build them simply type "make".

You'll need boost and a gcc version with C++11 support to build the tools provided with the SDK (statically linked binaries of these tools are provided in the bin directory). The KGraph API itself doesn't use boost or C++11 and you should be able to program with KGraph with older versions of GCC. If gcc cannot find FLANN, make will fail, but the tools not depending on FLANN should not be affected.

The tools "index" and "search" can be built to deal with different data types. The default is "float". In order to build the tools for a different data type, e.g. "uint8_t", edit Makefile and add "-DKGRAPH_VALUE_TYPE=uint8_t" to CXXFLAGS.

Compiling, Linking and Running with KGraph

You typically need to include the following in your C++ program:

#include <kgraph.h>
#include <kgraph-data.h>

If OpenCV or FLANN are also used, make sure kgraph-data.h comes after those. Pretty much everything in the library is under the namespace "kgraph".

Your program needs to be linked against libkgraph.so (in the bin library of SDK). This is typically achieved by putting libkgraph.so to somewhere gcc can find, like /usr/local/lib, and add "-libkgraph" to your linking command line. Or if libkgraph.so is in the current directly, add "libkgraph.so" directly to your linking command line after the other ".cpp" or ".o" files.

You also need to make sure libkgraph.so can be found when you run your program. This can be done by

$ sudo cp libkgraph.so /usr/local/lib
$ sudo ldconfig

If root permission is not available, expose the directly where you store libkgraph.so by

export LD_LIBRARY_PATH=DIR_OF_LIBKGRAPH_DOT_SO:$LD_LIBRARY_PATH