C(#error和#line)

用法

  • #error用于生成一个编译错误消息
    • #error message
    • message 不需要用双引号包围
  • #error是一种预编译器指示字
  • #error可用于提示编译条件是否满足

实例:

    #ifndef _cplusplus
    #error This file should be processed with C++ compiler.
    #endif
  • #line用于强制指定新的行号和编译文件名,并对源程序的代码重新编号
  • #line编译指示字的本质是重定义_ LINE _ 和 _ FILE _

用法

    #line number filename
    filename可省略

猜你喜欢

转载自blog.csdn.net/qq_34121068/article/details/80079528