s********1 发帖数: 581 | 1 gcc 编译的时候要包括 header source file 吗?
main.c 的程序中引用了sub.h 和 sub.c 中定义的function pphh(),
***************************************************************
//File: main.c
#include
#include "sub.h"
void main()
{
pphh();
}
*************************************************
//File: sub.h
#ifndef _sub_h
#define _sub_h
void pphh();
#endif
************************************************
//File: sub.c
#include
#include "sub.h"
void pphh()
{
printf("pphh\n");
}
************************ | p*********w 发帖数: 23432 | 2 为了让c语言能运行,有二个步骤——编译和链接。
编译的时候,不需要函数实体,有个 .h 的头文件说明一下接口就可以了
而 link 则需要函数实体才可以,而且函数实体不能重复的
【在 s********1 的大作中提到】 : gcc 编译的时候要包括 header source file 吗? : main.c 的程序中引用了sub.h 和 sub.c 中定义的function pphh(), : *************************************************************** : //File: main.c : #include : #include "sub.h" : void main() : { : pphh(); : }
|
|