spdlog网址https://github.com/gabime/spdlog
快速入门https://github.com/gabime/spdlog/wiki/1.-QuickStart
可以直接修改example下面的example.cpp
然后再编译
例子:
#include "spdlog/spdlog.h"int main()
{
//Use the default logger (stdout, multi-threaded, colored)
spdlog::info("Hello, {}!", "World");
}
spdlog::info(“Hello, {}!”, “World”);
一个{}对应后面一个""
效果:
[2022-10-19 10:10:13.947] [info] Hello, World!
重新编译,直接把build目录全部删除
cmake使用教程:https://www.coonote.com/linux-note/cmake-usage.html