可以用clion的debug模式运行程序,可以在log窗口查看出错位置,或者使用glog工具.
//在头文件包含
#include <glog/logging.h>
//在main函数或者类的构造函数中添加
google::InitGoogleLogging("mytest"); //初始化 glog
google::InstallFailureSignalHandler();
在CMakeLists.txt中
target_link_libraries(executable glog)