lib(发布)或libd(调试),可以为我解决这个问题

lib (release) or libd (debug), can Qt resolve this for me?

本文关键字:解决 问题 发布 libd 调试 lib      更新时间:2023-10-16

在Plug&绘制示例.pro呈现以下内容:

LIBS           = -Lplugins -lpnp_basictools
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
   mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
   win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
}

在这种特殊情况下,在调试模式下,将d附加到库名称,pnp_basictools变为pnp_basictoolsd。但它不能很好地扩展,即:

LIBS           = -Lplugins -lplugin_1 -lplugin_2 -lplugin_3
if(!debug_and_release|build_pass):CONFIG(debug, debug|release)
   win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d

似乎没有将d附加到plugin_2plugin_3

那么,我可以要求另一种方法在调试模式下将d添加到库名称中吗?

这里也提到了这个问题。

$$member(X, pos)返回列表变量X的位置pos处的项。因此,您找到的代码只处理该列表中的2个元素(0=>-Lplugins和1=>-lpnp_basictools)。

有一个for循环可以帮助您处理列表中的所有元素,但您可以"简单地"使用带有~=运算符的正则表达式:

win32:LIBS ~= s/-l(.*)/-l1d/g