Generate Linux library The Linux version uses centos7.3, compile and generate the library
After make is completed, the corresponding library file will be generated under .lib Using glog library under Linux Linux uses static libraries for testing. Copy the static library libglog.a and the header files of src/glog to your own project directory, create the main.cpp file, and add the following code: /******************************************************** Copyright (C), 2016-2018, FileName: main Description: Glog usage demo ************************************************************/ #include <stdio.h> #include "glog/logging.h" int main() { //Initialization parameters FLAGS_logtostderr = FALSE; //TRUE: standard output, FALSE: file output FLAGS_alsologtostderr = TRUE; //Do you need standard output in addition to the log file FLAGS_colorlogtostderr = FALSE; //Standard output with color FLAGS_logbufsecs = 0; //Set the maximum number of seconds that can buffer logs, 0 means real-time output FLAGS_max_log_size = 10; //Log file size (unit: MB) FLAGS_stop_logging_if_full_disk = true; //Whether to log to disk when the disk is full google::InitGoogleLogging("mqttserver"); google::SetLogDestination(google::GLOG_INFO,"./test"); LOG(INFO) << "this is log"; LOG(WARNING) << "this is warning"; LOG(ERROR) << "this is error"; google::ShutdownGoogleLogging(); } Compile: g++ main.cpp -o main -L. -lglog -lpthread Run: ./main The output is as follows: Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: Complete code for implementing the popular astronaut watch face based on JavaScript
I saw this question in the SQL training question ...
HTML provides five space entities with different ...
The functions of the three attributes flex-grow, ...
First we need to know the self-calling of the fun...
I've been learning Docker recently, and I oft...
Table of contents The role of foreign keys mysql ...
Why do we achieve this effect? In fact, this ef...
Table of contents Normal loading Lazy Loading Pre...
Data Type: The basic rules that define what data ...
MySql index detailed introduction and correct use...
1. Install JDK Check the computer's operating...
1. Check the currently installed PHP packages yum...
This article is mainly for those who do not under...
This article records the specific method of insta...
How to configure custom path aliases in Vue In ou...