First install the system requirements. Then follow the ydk-cpp README and install the C++ core, ietf bundle, openconfig bundle and cisco-ios-xr bundle.
$ mkdir build && cd build
$ cmake -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ ..
$ make && sudo make install
$ cd ..
Note: -v
will turn on verbose mode
$ cd build
$ ./bgp_xr_write ssh://<username>:<password>@<host address>:<port> [-v]
$ ./bgp_xr_read ssh://<username>:<password>@<host address>:<port> [-v]