用C #error指令? [英] #error directive in C?

查看:230
本文介绍了用C #error指令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否请您给的?

什么是 #ERROR 指令?有什么用呢?

What is #error directive? what the use of it?

推荐答案

这是用于(例如)preprocessor指令时,你想到的一个几个可能的 -D 符号定义,但没有一个。

It's a preprocessor directive that is used (for example) when you expect one of several possible -D symbols to be defined, but none is.

#if defined(BUILD_TYPE_NORMAL)
# define DEBUG(x) do {;} while (0) /* paranoid-style null code */
#elif defined(BUILD_TYPE_DEBUG)
# define DEBUG(x) _debug_trace x /* e.g. DEBUG((_debug_trace args)) */
#else
# error "Please specify build type in the Makefile"
#endif

当preprocessor打 #ERROR 指令,它会报告字符串作为一个错误消息,并且停止汇编;究竟是什么错误消息看起来像依赖于编译器。

When the preprocessor hits the #error directive, it will report the string as an error message and halt compilation; what exactly the error message looks like depends on the compiler.

这篇关于用C #error指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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