ubuntu or MacOS 源码安装 fmt fmtlib

1,前情

提醒这个源代码需要从release中下载 打包好的,而直接用git clone下载不了,可能github上的这个git clone的链接仅仅是给fmt lib的开发者使用的吧;

下载fmtlib的release源代码
u下载fmtlib的release源代码

2,解压编译安装

复制代码
401  tar zxf fmt-10.1.1.tar
  402  ls
  403  cd fmt-10.1.1
  404  ls
  405  mkdir build
  406  cd build
  407  ls
  408  cmake ..
  409  ls
  410  make -j
  411  cd bin
  412  ls
  413  ./core-test
  414  cd ..
  415  sudo make install

由于是在mac上下载的,所以下载下来的压缩包后缀为.tar;

解压命令倒是没变

效果:

3,示例

hello_fmt.cpp:

复制代码
#include <fmt/format.h>
#include <iostream>

int main()
{
        std::string first_string = fmt::format("{0} the fmt {1} {2}", "Hello", "world!", 123);
        std::cout << first_string <<std::endl;

        return 0;
}

运行效果:

编译命令:

g++ hello_fmt.cpp -lfmt -std=c++11

注意代码库使用了 c++11标准编写

相关推荐
dragoooon341 天前
[Linux系统编程——Lesson6.进程切换与调度]
linux·运维·服务器
Python私教1 天前
5分钟上手 MongoDB:从零安装到第一条数据插入(Windows / macOS / Linux 全平台图解)
windows·mongodb·macos
胖咕噜的稞达鸭1 天前
缝合怪deque如何综合list和vector实现及仿函数模板如何优化priority_queue实现
数据结构·c++·算法·链表·list
tt5555555555551 天前
C++ 经典数组算法题解析与实现教程
开发语言·c++·算法
waves浪游1 天前
Linux基本指令(下)
linux·运维·服务器
K_i1341 天前
探索Linux:开源世界的钥匙
linux
The Future is mine1 天前
.Net Core 在Linux系统下创建服务
linux·运维·.netcore
泽虞1 天前
《Qt应用开发》笔记
linux·开发语言·c++·笔记·qt
报错小能手1 天前
linux学习笔记(21)线程同步——互斥锁
linux·笔记·学习
小邓儿◑.◑1 天前
贪心算法 | 每周8题(二)
c++·算法·贪心算法