#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时就会出现如下的问题 ...
随机推荐
- MYSQL初级学习笔记二:数据表相关操作及MySQL存储引擎!(视频序号:初级_5,7-22|6)
知识点三:数据表相关操作(5,7-22) --------------------------------整型--------------------------------- --测试整型 CREA ...
- let 命令 与 var的区别
ES6 新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效. <script> { let a = 10; var b = 1; } ...
- leetcode 字符串动态规划总结
问题1:leetcode 正则表达式匹配 请实现一个函数用来匹配包括'.'和'*'的正则表达式.模式中的字符'.'表示任意一个字符,而'*'表示它前面的字符可以出现任意次(包含0次). 在本题中,匹配 ...
- ASP.NET Core:WebAppCoreAngular
ylbtech-ASP.NET Core:WebAppCoreAngular 1.返回顶部 1. 2. 3. 4. 5. 6. 2.返回顶部 3.返回顶部 4.返回顶部 5.返回顶部 ...
- 文件的创建,读取,写入,修改,删除---python入门
转自:http://blog.163.com/jackylau_v/blog/static/175754040201181505158356/ 一.用Python创建一个新文件,内容是从0到9的整数, ...
- ndoejs后台查询数据库返回的值-进行解析
JSON.parse(jsonstr); //可以将json字符串转换成json对象 JSON.stringify(jsonobj); //可以将json对象转换成json对符串
- View Programming Guide for iOS ---- iOS 视图编程指南(四)---Views
Views Because view objects are the main way your application interacts with the user, they have many ...
- Struts2基本使用
Struts2:本质servlet 1.接受页面参数 a.使用原生的ServletAPI接受(不推荐) request.getParameter(name) 获取元素request方式: --Http ...
- pojcoin【未完待续】
题意: 给你一些数字的种类,然后拥有这个种类的各个数量,输出可以组成多少数字,数字范围在1-m: 思路: 卧槽好难-
- PTA QQ Account Manageme【map的巧妙应有】
5-27 QQ Account Management (25分) You are supposed to implement the functions of account "Log in ...