Install google-glog 0.6.0 on Ubuntu 22.04

Download and compile and install goolge glog

$ git clone https://github.com/google/glog.git 

$ sudo apt install autoconf automake libtool

$ cd glog

$ cmake -S . -B build -G "Unix Makefiles"

$ cmake --build build

$ cd build

$ make

$ sudo make install

$ sudo ldconfig

Test


#include <iostream>
#include <glog/logging.h>

int main(int argc, char **argv)
{
    google::SetLogDestination(google::INFO, "/home/jimmy/glog.log");
    google::InitGoogleLogging("log_test");
    LOG(INFO) << "This is INFO!";
    LOG(WARNING) << "This is WARNING!";
    LOG(ERROR) << "This is ERROR!";
    LOG(FATAL) << "This is FATAL";
    return 0;
}
Compile command is as following:
$ g++ glog_test.cc -lglog

Comments

Popular posts from this blog

BdsDex: failed to load Boot0001 "UEFI BHYVE SATA DISK BHYVE-OABE-20A5-E582" from PciRoot(0x0)/Pci (0x2, 0x0)/Stat(0x0,0xFFFF,0x0) : Not Found

How To Install Nginx, MySQL and PHP (FEMP) Stack on FreeBSD 13.0

Install samba on FreeBSD(on VMware Workstation) to share files with Window.