gpt4 book ai didi

Qt - QMAKE_LIBDIR 与 LIBS

转载 作者:行者123 更新时间:2023-12-04 11:06:05 27 4
gpt4 key购买 nike

可以找到很多使用 QMAKE_LIBDIR 指定附加库目录的示例。

Qt手册说:

QMAKE_LIBDIR

Specifies a list of system library paths. The value of this variable is typically handled by qmake or qmake.conf and rarely needs to be modified.



到目前为止,每当我想在我的项目之一中使用外部库并且不想使用库向导时,我总是使用“unix:-L$$(LIB_DIR)-l”或类似的方法。

我是否可以得出结论,即使手册中没有相应的声明,也不鼓励通过 -L 指定路径? (根据 this post 不鼓励 - 但为什么呢?)

提前致谢。

最佳答案

在某种程度上有一个相应的陈述。把您的 -Lpath/to/dirLIBS多变的:

http://doc.qt.io/qt-5/qmake-variable-reference.html#libs

LIBS

Specifies a list of libraries to be linked into the project. If you use the Unix -l (library) and -L (library path) flags, qmake handles the libraries correctly on Windows (that is, passes the full path of the library to the linker). The library must exist for qmake to find the directory where a -l lib is located.

For example:

unix:LIBS += -L/usr/local/lib -lmath

win32:LIBS += c:/mylibs/math.lib



因此,使用 -LLIBS实际上受到 Qt 文档的鼓励

关于Qt - QMAKE_LIBDIR 与 LIBS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24511097/

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