#error和#line使用分析
#error的用法
- #error用于生成一个编译错误消息
- 用法:error message(不需要用双引号包围)
- #error编译指示字用于自定义程序员特有的编译错误,消息类似的
- #warning用于生成编译警告
- #error是一种预编译器指示字
- #error可用于提示编译条件是否满足
编译过程中的任意错误信息意味着无法生成最终的可执行程序
例子1:#error预处理初探
#include<stdio.h>
#ifndef __cplusplus
#error This file should be processed with c++ compliler.
#endif // __cplusplus
class CppClass
{
private:
int m_value;
public:
CppClass(){}
~CppClass(){}
};
int main()
{
return 0;
}
#line的用法
#line用于强制制定新的行号和编译文件名,并对源程序的代码重新编号
用法:#line number filename(filename可以省略)
#line编译指示字的本质是重定义 LINE__和__FILE
#include <stdio.h>
int main()
{
printf("%s : %d\n", __FILE__, __LINE__);
#line 1 "change.c"
printf("%s : %d\n", __FILE__, __LINE__);
return 0;
}
小结
- #error用于自定义一条编译错误信息
- #warning用于自定义一条编译警告信息
- #error和#warning常用于条件编译的情形
- #line用于强制指定新的行号和编译文件名
#error和#line使用分析的更多相关文章
- 第23课 - #error 和 #line 使用分析
第23课 - #error 和 #line 使用分析 1. #error 的用法 (1)#error 是一个预处理器指示字,用于生成一个编译错误消息,这个消息最终会传递到编译器(gcc) 在思考这一点 ...
- 第23课 #error和#line使用分析
#error的用法: 示例程序: #include <stdio.h> #ifndef __cplusplus #error This file should be processed w ...
- Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.
启动tomcat, 出现, ( 之前都是好好的... ) [lk ] ERROR [08-12 15:10:02] [main] org.springframework.web.context.Con ...
- 关于xml加载提示: Error on line 1 of document : 前言中不允许有内容
我是在java中做的相关测试, 首先粘贴下报错: 读取xml配置文件:xmls\property.xml org.dom4j.DocumentException: Error on line 1 of ...
- (转载)Flash Loader加载完成不发送COMPLETE和ERROR事件的问题分析
(转载)http://blog.dou.li/flash-loader%E5%8A%A0%E8%BD%BD%E5%AE%8C%E6%88%90%E4%B8%8D%E5%8F%91%E9%80%81co ...
- error on line 1 at column 6: XML declaration allowed only at the start of the document
This page contains the following errors: error on line 1 at column 6: XML declaration allowed only a ...
- "fatal: protocol error: bad line length character: No This"
git clone 远程地址时候出现 "fatal: protocol error: bad line length character: No This" 错误 在stackov ...
- Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "</url-pattern>" 终止
1.错误描述 严重: Parse Fatal Error at line 41 column 24: 元素类型 "url-pattern" 必须由匹配的结束标记 "< ...
- (转)Windows 平台下解决httpd.exe: syntax error on line 39
近来在研究PHP,结果为了Apache的安装伤神不已...小白我在安装后,启动Apache的服务虽然可以,不过,在Apache sevice monitor 中启动services时就会出现如下的问题 ...
随机推荐
- IO、FileInputStream、(二十)
1.IO流概述及其分类 * 1.概念(什么是IO?) * IO流用来处理设备之间的数据传输 * Java对数据的操作是通过流的方式 * Java用于操作流的类都在IO包中 * 流按流向分为两种:输入流 ...
- java性能时间与空间消耗
Java性能时间与空间消耗 一.减少时间消耗 标准代码优化 (1) 将循环不变量的计算移出循环 例如:for (int i=0; i<size()*2; i++) { ... } ------& ...
- MYSQL进阶学习笔记四:MySQL存储过程之定义条件,处理过程及存储过程的管理!(视频序号:进阶_11,12)
知识点五:MySQL存储过程之定义条件和处理过程及存储过程的管理(11,12) 定义条件和处理: 条件的定义和处理可以用来定义在处理过程中遇到的问题时相应的处理步骤. DECLARE CONTINUE ...
- 栏目抓取网站日kafka
#!/usr/bin/python3#-*- coding:utf-8 -*-"""create 2018-02-27author zldesc: https://ind ...
- Html5--6-46 渐变效果
Html5--6-46 渐变效果 学习要点 掌握线性渐变和径向渐变的使用 线性渐变: 属性:linear-gradinet(开始位置 角度,起始颜色,终止颜色 ) 开始位置:渐变开始的位置,属性值可以 ...
- SPOJ:Strange Waca(不错的搜索&贪心&剪枝)
Waca loves maths,.. a lot. He always think that 1 is an unique number. After playing in hours, Waca ...
- zepto.js 总结
zepto.js 中的注意事项 ,详见:http://www.cnblogs.com/samwu/archive/2013/06/06/3121649.html zepto被弃用的原因:详见:http ...
- 线程间操作无效: 从不是创建控件“xxxxxxxx”的线程访问它。
方法一: Control.CheckForIllegalCrossThreadCalls = false; 方法二:(推荐) this.Invoke(new MethodInvoker(() => ...
- C++ STL自学总结,仅供参考
本文内容,为博主在网上看到资料总结整合而来 一.stl格式简介 .stl文件是在计算机图形应用系统,来表示封闭的面或者体,用来表示三角形网格的一种文件格式.为STereo Lithography的缩写 ...
- NYOJ4——ASCII码排序
ASCII码排序 时间限制:3000 ms | 内存限制:65535 KB 难度:2 描述:输入三个字符(可以重复)后,按各字符的ASCII码从小到大的顺序输出这三个字符. 输入:第一行输入一 ...