Skip to content

Latest commit

 

History

History
executable file
·
88 lines (53 loc) · 1.88 KB

cpp.rst

File metadata and controls

executable file
·
88 lines (53 loc) · 1.88 KB

C++ API

This chapter describes the mine C++ wrapper. The class is declared in the header file cppmine.h, located in the libmine/ folder. You need to add #include "cppmine.h" in your C++ source files and link your program with mine.c and cppmine.c.

See the c_api documentation.

Example

The example is located in examples/cpp_example.cpp.

../../examples/cpp_example.cpp

To compile the example, open a terminal, go into the example (examples/) folder and run:

$ g++ -O3 -Wall -Wno-write-strings cpp_example.cpp ../libmine/cppmine.cpp \
  ../libmine/mine.c -I../libmine/

Run the example by typing:

MIC: 0.999999
MAS: 0.728144
MEV: 0.999999
MCN (eps=0): 4.58496
MCN (eps=1-MIC): 4.58496
TIC: 67.5236

A more simple example

The example is located in examples/cpp_example2.cpp.

../../examples/cpp_example2.cpp

To compile the example, open a terminal, go into the example (examples/) folder and run:

$ g++ -O3 -Wall -Wno-write-strings cpp_example2.cpp ../libmine/cppmine.cpp \
  ../libmine/mine.c -I../libmine/

Run the example by typing:

$ ./a.out
MIC: 0.291692