问题:无论在Linux的Qt Creator 2.8.1中选择了调试还是发行版,始终会评估CONFIG(debug,debug | release)和CONFIG(release,deubg | release)。
我在Qt Creator应用程序中的配置(库存-新项目的默认配置):
Projects->Build Settings->Debug Build Steps:
qmake build configuration: Debug
Effective qmake call: qmake2 proj.pro -r -spec linux-gnueabi-oe-g++ CONFIG+=debug
Projects->Build Settings->Release Build Steps:
qmake build configuration: Release
Effective qmake call: qmake2 proj.pro -r -spec linux-gnueabi-oe-g++
我在proj.pro中的配置:
message(Variable CONFIG:)
message($$CONFIG)
CONFIG(debug,debug|release)
{
message(Debug build)
}
CONFIG(release,debug|release)
{
message(Release build)
}
控制台上的调试输出:
Project MESSAGE: Variable CONFIG:
Project MESSAGE: lex yacc warn_on debug uic resources warn_on release incremental link_prl no_mocdepend release stl qt_no_framework debug console
Project MESSAGE: Debug build
Project MESSAGE: Release build
在控制台上输出以发布:
Project MESSAGE: Variable CONFIG:
Project MESSAGE: lex yacc warn_on uic resources warn_on release incremental link_prl no_mocdepend release stl qt_no_framework console
Project MESSAGE: Debug build
Project MESSAGE: Release build
在Windows 7下,我对此类.pro配置没有遇到任何问题,并且工作正常。我绝望地修改了.pro文件:
CONFIG = test
message(Variable CONFIG:)
message($$CONFIG)
CONFIG(debug,debug|release)
{
message(Debug build)
}
CONFIG(release,debug|release)
{
message(Release build)
}
我对输出感到惊讶:
Project MESSAGE: Variable CONFIG:
Project MESSAGE: test
Project MESSAGE: Debug build
Project MESSAGE: Release build
因此,即使我完全清理了CONFIG变量,它仍然可以看到调试和发布配置。
我在做什么错?
Qmake太疯狂了,这是唯一可行的解释。整个发行版/调试程序多次处于配置状态,闻起来就像一个旧的设计错误,直到很晚才解决,并且已经编写了太多的配置。还记得make中的标签吗?杜德(Dude)有15位用户,因此他从不解决错误的决定。
无论如何。
我在Linux上的Qt 4.8.4.1。上看到了同样的问题。
解决方法是:删除大括号前的换行符。
从字面上看,这是可行的:
CONFIG(release, debug|release) {
message(Release)
}
CONFIG(debug, debug|release) {
message(Debug)
}
虽然这不是:
CONFIG(release, debug|release)
{
message(Release)
}
CONFIG(debug, debug|release)
{
message(Debug)
}
我怀疑这是qmake的几个版本中的解析错误,可能仅在Linux方面。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句