glog简单使用

本文介绍了glog库在Windows和Linux上的编译步骤,包括CMake的使用,以及在Windows环境下配置Visual Studio项目时的额外包含目录、库目录和依赖项设置。还提及了glog的日志级别管理和性能优化方法。
摘要由CSDN通过智能技术生成
git clone https://github.com/google/glog.git/ .

or:

svn co https://github.com/google/glog.git/ .

windows: download cmake (www.cmake.org) generate cmake .sln file(glog.sln).

linux: cmake . && make && make install

simple testcase:

#if defined(WIN32)||defined(WINDOWS)
#error("Not supported")
#include <windows.h>
#include <io.h>
#include <direct.h>
#else
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#endif

#include <string.h>

#define GOOGLE_GLOG_DLL_DECL
#define GLOG_NO_ABBREVIATED_SEVERITIES
#include "glog/logging.h"


bool dirExists(const std::string& dirName_in)
{
	return access(dirName_in.c_str(), F_OK) == 0;
}

#include <string>
#include <iostream>

void init_glog(const char*
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值