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标准编写

相关推荐
ysa0510302 小时前
动态规划-逆向
c++·笔记·算法
燃于AC之乐2 小时前
我的算法修炼之路--7—— 手撕多重背包、贪心+差分,DFS,从数学建模到路径DP
c++·算法·数学建模·深度优先·动态规划(多重背包)·贪心 + 差分
闻缺陷则喜何志丹2 小时前
【BFS 动态规划】P12382 [蓝桥杯 2023 省 Python B] 树上选点|普及+
c++·蓝桥杯·动态规划·宽度优先·洛谷
小天源2 小时前
linux漏洞一键扫描
linux·运维·服务器·漏洞扫描
码农水水3 小时前
中国邮政Java面试被问:容器镜像的多阶段构建和优化
java·linux·开发语言·数据库·mysql·面试·php
福楠3 小时前
C++ STL | map、multimap
c语言·开发语言·数据结构·c++·算法
wifi chicken3 小时前
Linux Wlan L3~L2封包逻辑详解
linux·网络·ping·封包
Sarvartha4 小时前
二分查找学习笔记
数据结构·c++·算法
daidaidaiyu4 小时前
一文入门 Android NDK 开发
c++
Ethernet_Comm4 小时前
从 C 转向 C++ 的过程
c语言·开发语言·c++