gpt4 book ai didi

c++ - 调用 qdecimal 库函数

转载 作者:行者123 更新时间:2023-11-28 06:18:51 25 4
gpt4 key购买 nike

我正在尝试使用 qdecimal library而且我无法调用任何公开的方法。我已成功构建库文件 (libdecnumber.a) 并将其及其包含文件添加到我的项目的 .pro 文件中,并包含相关标题,如 example 1 中所述。在自述文档中。我可以使用库中的#defines 和其他类型,但对于任何函数调用,我总是会得到“ undefined reference ”。

例如,

//these compile
#include "decNumber.h" // base number library
decNumber a, b; // working numbers
decContext set; // working context

//this does not
decNumberFromString(&b, "test", &set);

这是否表明库未正确添加到项目中,还是其他原因?

最佳答案

如果您使用的是 QtCreator,请打开其中的 .pro 文件并添加行

LIBS += -ldecnumber

如果需要,您可以使用 -L"...path here..."指定路径

目前您还没有将您的项目与库链接。

关于c++ - 调用 qdecimal 库函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29671836/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com