下午做了一个小的程序,定义了三个文件:getop.h,getop.c,calcDemo.c 显然getop.h是针对getop.c的,而在calcDemo.c中要调用到getop.c中的东西。 首先给出每个文件的结构图,为了更简单的说明,函数都空实现。 getop.h: #ifndef _H_GETOP getop.c
#include <stdio.h>
} #define BUFSIZE 100 int getch(void) void ungetch(int c) calcDemo.c #include <stdio.h>
最后,即是利用gcc来编译这几个文件: gcc getop.c calcDemo.c -o output.out 编译后的目标文件即为:output.out 然后执行:./output.out即可
|
|
来自: Rainboy913 > 《C多文件编译》