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

相关推荐

  1. 安装git

    2023-12-11 09:32:03       39 阅读
  2. LInux、编译安装

    2023-12-11 09:32:03       32 阅读
  3. ubuntu安装nginx

    2023-12-11 09:32:03       17 阅读
  4. Linux安装

    2023-12-11 09:32:03       10 阅读

最近更新

  1. TCP协议是安全的吗?

    2023-12-11 09:32:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2023-12-11 09:32:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2023-12-11 09:32:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2023-12-11 09:32:03       20 阅读

热门阅读

  1. 什么是css初始化

    2023-12-11 09:32:03       41 阅读
  2. leetcode每日一题38

    2023-12-11 09:32:03       40 阅读
  3. 在Vue 3中如何禁止网页返回到上一页

    2023-12-11 09:32:03       28 阅读
  4. Python基础期末复习 新手

    2023-12-11 09:32:03       40 阅读
  5. 程序员常用英文单词

    2023-12-11 09:32:03       25 阅读
  6. android-xml语法

    2023-12-11 09:32:03       33 阅读
  7. MapReduce

    2023-12-11 09:32:03       25 阅读
  8. 华为鸿蒙HarmonyOS应用开发者高级认证试题及答案

    2023-12-11 09:32:03       143 阅读
  9. web项目创建流程框架

    2023-12-11 09:32:03       42 阅读
  10. 《C++新经典设计模式》之第15章 适配器模式

    2023-12-11 09:32:03       30 阅读
  11. C++(14):获取类型在tuple中的索引

    2023-12-11 09:32:03       32 阅读