問題描述
我正在使用 Qt Creator 并且有一個依賴于 C++ 靜態庫項目的 Qt GUI 項目.我想將 GUI 應用程序的發布版本與 .lib 的發布版本和 GUI 應用程序的調試版本與調試 .lib 鏈接起來.通過在我的 .pro 文件中包含如下一行,我找到了如何向項目添加其他庫的方法:
LIBS += -L./libfolder -lmylib.lib
但我不知道如何使用不同的 -L
命令進行發布和調試版本.
qmake 是否支持這樣做?
在你的項目文件中你可以做這樣的事情
調試{LIBS += -L./libfolder -lmydebuglib.lib}釋放 {LIBS += -L./libfolder -lmyreleaselib.lib}
如果 DEBUG 已添加到 CONFIG qmake 變量中,則使用調試括號內的位,如果 RELEASE 已添加到 CONFIG 變量中,則釋放括號內的內容也將包含在內.
您也可以使用!debug"而不是release"(即當調試不在配置中時)
您可以在此處找到有關 qmake 的更多信息.>
I am using Qt Creator and have a Qt GUI project that depends on a C++ static library project. I want to link the release version of the GUI app with the release build of the .lib and the debug release of the GUI app with the debug .lib. I have found out how to add additional libraries to the project by including a line like the following in my .pro file:
LIBS += -L./libfolder -lmylib.lib
But I cannot see how I can use a different -L
command for release and debug builds.
Is there support in qmake to do this?
In your project file you can do something like this
debug {
LIBS += -L./libfolder -lmydebuglib.lib
}
release {
LIBS += -L./libfolder -lmyreleaselib.lib
}
The bit inside the debug braces is used if DEBUG has been added to the CONFIG qmake variable, similarly stuff inside the release brackets is included if RELEASE has been added to the CONFIG variable.
You can also use "!debug" rather than "release" (i.e. when debug isn't in the config)
You can find more information on qmake here.
這篇關于使用 qmake/Qt Creator 與調試/發布庫鏈接的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!