Qt是否提供(保证)调试定义? [英] Does Qt offer a (guaranteed) debug definition?

查看:171
本文介绍了Qt是否提供(保证)调试定义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道官方支持的方式,在Qt中包含调试生成唯一的代码?例如:

  #ifdef QT_DEBUG 
//做某事
#endif

基本上像Q_ASSERT,但更复杂的测试。



我可以'似乎找到任何说明Qt框架保证定义一个调试宏的文档。如果没有,那么将是一个明智的,非官方的方式来实现这个功能项目?

解决方案

p> Qt为发布版本定义了 QT_NO_DEBUG 。否则 QT_DEBUG 被定义。



当然,您可以自由指定任何 DEFINES 在.pro文件中,并为 debug 发布


Does anyone know an officially supported way to include debug-build only code in Qt? For example:

#ifdef QT_DEBUG
// do something
#endif

Basically like Q_ASSERT but for more complex tests.

I can't seem to find any documentation which says that the Qt framework guarantees to define a debug macro. If there isn't, what would be a sensible unofficial way to implement this feature project wide?

解决方案

Qt defines QT_NO_DEBUG for release builds. Otherwise QT_DEBUG is defined.

Of course you are free to specify any DEFINES in your .pro files and scope them for either debug or release.

这篇关于Qt是否提供(保证)调试定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆