我正在使用 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模板网!
如何在 C++ 中读取和操作 CSV 文件数据?How can I read and manipulate CSV file data in C++?(如何在 C++ 中读取和操作 CSV 文件数据?)
在 C++ 中,为什么我不能像这样编写 for() 循环:In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,为什么我不能像这样编写 for() 循环: for(
OpenMP 如何处理嵌套循环?How does OpenMP handle nested loops?(OpenMP 如何处理嵌套循环?)
在循环 C++ 中重用线程Reusing thread in loop c++(在循环 C++ 中重用线程)
需要精确的线程睡眠.最大 1ms 误差Precise thread sleep needed. Max 1ms error(需要精确的线程睡眠.最大 1ms 误差)
是否需要“do {...} while ()"?环形?Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?环形?)