Glog编译使用

Tools:Cmake、VS2017git

Option:Git、dependcygithub

src:glog https://github.com/google/glog.git,日志库api

        gflags https://github.com/gflags/gflags.git,命令行处理库,依赖shlwapi.libgoogle

一、下载源码命令行

二、cmake,编译gflags,须要勾选环境定义gflags的宏定义变量日志

三、cmake,编译glogget

四、vs编译gflags,vs编译glog源码

五、使用it

a、库依赖:glog.lib->gflags_static.lib->ShLwApi.Lib;io

b、设置预处理:

GOOGLE_GLOG_DLL_DECL=
GLOG_NO_ABBREVIATED_SEVERITIES

c、头文件引用:#include <glog/logging.h>

头文件须要包含log_severity.h,文件目前版本没有负责拷贝这个文件,须要手动处理

d、调用

google::InitGoogleLogging("HelenXR_glog_program");

LOG(INFO) << "google log first info level message!";

google::ShutdownGoogleLogging();

相关文章
相关标签/搜索