如何使用 C++ CentOS9 上的 fmt 吗?

发布于 2025-01-20 15:49:47 字数 831 浏览 1 评论 0原文

我使用DNF安装FMT安装了fmt。这是成功的。但是,当我尝试将其用作#include< fmt/format.h>时,它说找不到。我从fmt git页面下载了 inclage ,它可以找到format.h现在使用-i ...,但我有编译错误。

undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
collect2: error: ld returned 1 exit status

我尝试了-lfmt,但是

/usr/bin/ld: cannot find -lfmt

我无法在git上找到此类使用的任何帮助。

您如何在不构建fmt 手动项目上使用fmt lib lib?

EIDT:DNF安装输出

I installed fmt using dnf install fmt. It was successful. But when I try to use it as #include <fmt/format.h> it says it is not found. I downloaded include from fmt git page so it finds format.h now with -I... but I have compilation errors.

undefined reference to `fmt::v8::vformat[abi:cxx11](fmt::v8::basic_string_view<char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::appender, char> >)'
collect2: error: ld returned 1 exit status

I tried -lfmt but it errors with

/usr/bin/ld: cannot find -lfmt

I cant find any help for this type of use on the git.

How do you use fmt lib on CentOS9 without building fmt project manually?

EIDT: dnf install output
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最舍不得你 2025-01-27 15:49:47

Fedora/RHEL/CentOS 对安装共享库的所有软件包使用以下命名约定:

名称 - 此软件包包含运行与此库链接的程序所需的运行时共享库​​。

name-devel - “devel”包包含头文件和符号链接,允许您在开发使用该库的应用程序时链接到共享库。

您需要这两个包来编译使用该库的代码。 devel 包指定了对主包的依赖,因此 dnf install name-devel 将安装这两个包。

您应该投入一点时间来学习如何构建自己的 rpm 包。事情没那么复杂。当您构建软件包时,rpmbuild 将负责分析生成的二进制文件,发现它链接的共享库,然后在您自己的 rpm 软件包中记录适当的依赖项,以便安装它只会拉入主 name 包。

Fedora/RHEL/CentOS uses the following naming convention for all packages that installed shared libraries:

name - this package contains runtime shared libraries that are needed to run programs that are linked with this library.

name-devel - the "devel" packages contains header files and the symbolic links that allow you to link with the shared library when developing applications that use this library.

You need both packages to compile the code that uses the library. The devel package specifies a dependency on the main package, so dnf install name-devel is going to install both packages.

You should invest a little bit of time to learn how to build your own rpm packages. It's not that complicated. When you build your package rpmbuild will take care of analyzing the resulting binary, discovering which shared libraries it links with, then recording the appropriate dependency in your own rpm package, so installing it will pull in only the main name package.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文