c语言头文件解析,c语言头文件解析(C language header file parsing).doc

c语言头文件解析(C language header file parsing)

c语言头文件解析(C language header file parsing)

C language.H and.C file analysis (2010-03-11 18:07:37) reprint labels: Gossip

Simple said that in fact to understand the C file and header files (.H) what is different, first need to understand the working process of the compiler, the compiler will generally do the following:

1. preprocessing

2. lexical and syntax analysis phase

The 3. compilation stage, first compiled into pure assembler statements, then compiled with CPU binary code, to generate the target file (.Obj file)

The 4. connecting stage, each section of each code in the object file for the absolute address generation, associated with platform specific executable file, of course, also can generate pure binary code with objcopy, is to remove the file format information. (.Exe file)

The compiler at compile time is based on the C file as a unit, that is to say if a C file in your project are not, then your project will not compile to the target file connector is for the unit, it will carry out re positioning function and variable of one or more of the target file, generate the final the executable program, developed in PC, generally have a main function, this is the compiler agreed, of course, if you write the linker script yourself, you can not main function as the entrance program!!!!

(main.C file object file executable file)

With these basic knowledge, and so, in order to create a final executable file, you need some of the target file is C file, C file and the entrance to a main function as the executable program, then we start from a C file, if the contents of the C file the following:

#include

#include "mytest.h"

Int main (int argc, char **argv)

{

Test = 25;

Printf ("test.................%d\n, test);

}

The header file as follows:

Int test;

Now in this example to explain the compiler work:

1. preprocessing stage: the compiler in C file as a unit, first read the C file, find the first sentence and the second sentence contains a header file, will find the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值