as snippet.
/* * config1.cpp * * Author, Copyright: Oleg Borodin <onborodin@gmail.com> */ #include <iostream> #include <libconfig.hpp> int main(int argc, char **argv) { libconfig::Config config; try { config.readFile("test.conf"); } catch (std::exception& e) { std::cerr << e.what() << std::endl; return 1; } std::string foo = config.lookup("foo"); std::cout << foo << std::endl; try { libconfig::Setting &setting = config.lookup(""); int n = setting["list"][2]; std::cout << n << std::endl; } catch (std::exception& e) { std::cerr << e.what() << std::endl; return 1; } return 0; }