创建自定义#warning标志 [英] Create custom #warning flags

查看:81
本文介绍了创建自定义#warning标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个商业应用程序,我们正在使用一些GPL代码来帮助我们.

I'm building a commercial app, and we are using some GPL code to help us along.

如何添加#warning#error语句,以便在为调试而构建代码时发出警告,而在为发布而构建时却引发错误?

How can I add #warning or #error statements so that when the code is built for debug, it warns, but when we build for release it throws errors?

我可以做到:

#warning this code is released under a CCL licensing scheme, see Source_Code_License.rtf
#warning this code is not LGPL-compliant
#warning this code was copied verbatim from a GP Licensed file

在文件开头,但是我可以做得更好吗?如果有文件,是否有更好的标记文件的方法?

at the beginning of files, but can I do better? Is there a better way of tagging a file if it's included?

我正在将Objective-C ++与gcc或clang一起使用.

I'm using Objective-C++ with gcc or clang.

推荐答案

请改用#pragma消息.

Use #pragma message instead.

这篇关于创建自定义#warning标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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