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
Background <br />Students who work on the fr...
Table of contents First look at the effect: accom...
MongoDB is a high-performance database, but in th...
First, the HTML code to embed the video in the pag...
Introduction to structure and performance HTML st...
Table of contents Preface Create a bridge network...
I have always used Loadrunner to do performance t...
Table of contents introduce Installation and Usag...
I don’t know if you have noticed that when we ope...
First we create the database table: CREATE TABLE ...
Table of contents Introduction How to connect to ...
This article shares with you how to use JavaScrip...
1. Installation and use First, install it in your...
Encapsulate el-dialog as a component When we use ...
I have a product parts table like this: part part...