1.CMackLists.txt
set( YAML_LIBS "/usr/lib/x86_64-linux-gnu/libyaml-cpp.so" )
target_link_libraries( feature_training ${catkin_LIBRARIES} ${OpenCV_LIBS} ${DBoW3_LIBS} ${YAML_LIBS})
Note: The path of libyaml-cpp.so may different in different computer, so find this file first
2.In the .cpp file
#include "/usr/include/yaml-cpp/yaml.h"
YAML::Node config = YAML::LoadFile("/home/vpm/catkin_ws/src/loop_closure/src/config_loop.yaml");
string img_path = config["img_path"].as<string>();
Note: the same as below, the path of yaml.h may different in different computer, so find this file first