linux下gcc-多文件编译

来源:互联网 发布:淘宝恶意差评怎么办 编辑:程序博客网 时间:2024/05/21 04:02

#ifndef _HEAD_H_

#define _HEAD_H_

void test1();

void test2();

void test3();


#endif 


#include<stdio.h>


void test1()

{

printf("test1\n");

}


#include<stdio.h>


void test1()

{

printf("test2\n");

}



#include<stdio.h>


void test1()

{

printf("test3\n");

}



#include <stdio.h>

#include "head.h"


void main()

{

test1();

test2();

test3();

}


编译步骤:

gcc -c test1.c test2.c test3.c main.c    // 或者gcc -c  *.c


gcc -o main *.o


./main




0 0
原创粉丝点击