gpt4 book ai didi

c++ - 如何在 C++ Qt Creator 中使用库

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

我下载了一个用于处理 DicOM 文件的库。
图书馆的树是:

|--include
|-----dicom.h
|-----dicomcfg.h
|--lib
|--------dicomsdl.lib

但我不知道如何使用和内置的Qt Creator。
如果有人能帮助我,我将不胜感激。

最佳答案

我假设您使用 qmake 作为构建系统。要链接您的“外部”库,您需要在 .pro 文件中进行以下更改:

#path to includes directory of your library, qmake will try to find includes there
INCLUDEPATH += /path/to/library/include

#path to pre-compiled library directory
LIBS += -L/path/to/precomp/library

#link your pre-compiled library, -l<library name> w/o .so, .a, .lib, lib- prefix
LIBS += -ldicomsdl

也许您需要使用编译器从源代码构建库。如果编译器不匹配,可能会出现一些问题。

关于c++ - 如何在 C++ Qt Creator 中使用库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29030413/

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