一、实验目的
1、掌握Linux 下的C语言编译的基本方法
2、理解make工具的功能,学会编制makefile的方法
二、 实验内容
1、利用gcc编译C语言程序,使用不同的选项,观察并分析显示结果
2、编写一个由多文件构成的C语言程序,编制makefile,运行make工具进 行维护。
三、 主要实验步骤
1、设计一个程序,打印输出输入数字的正弦值。 要求定义属于自己的头文件,并且放在另外的目录中。使用下列选项进行编译:-I, -E, -c , –o , -l 。参考教材的P155-158节的内容。
2、针对下面4个C语言程序,main.c, one.c, two.c, public.h.。写一个makefile 文件,运行make工具进行维护。public.h 在另外的目录中。
Main.c:
include "public.h"
int main()
{
printf("main ...\n"); show1(); show2(); return 0;
}
One.c
#include "public.h"
void show1()
{
printf("hello, this show1 \n"); }
Two.c
#include "public.h"
void show2()
{
printf("hello, this show2 \n"); }
public.h
#ifndef __MANYCO_MAKEFILE_PUBLIC_1
#define __MANYCO_MAKEFILE_PUBLIC_1
#include
void show1();