【问题标题】:lib (release) or libd (debug), can Qt resolve this for me?lib(发布)或 libd(调试),Qt 可以为我解决这个问题吗?
【发布时间】:2017-08-21 00:38:38
【问题描述】:

Plug & Paint Example 中,.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 添加到库名称中吗?

here也提到了这个问题。

【问题讨论】:

    标签: c++ qt c++11 qt5


    【解决方案1】:

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

    有一个for loop 可以帮助您处理列表中的所有元素,但您可以“简单地”使用带有~= operator 的正则表达式:

    win32:LIBS ~= s/-l(.*)/-l\1d/g
    

    【讨论】:

    • 有趣的事情。请您提供有关此正则表达式的更多信息吗?
    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多