linux下写软件,linux下自己写个软件

一、首先是建立三个文件 test_1.c test_2.c test_3.c

test_1.c

#include

#include

int main(){

printf("Holle World 1111111111 \n");

linkme2();

}

test_2.c

#include

#include

int linkme2(void){

printf("Holle World 222222222222222\n");

linkme3();

}

test_3.c

#include

#include

int linkme3(void){

printf("Holle World 333333333333\n");

}

二、进行编译

gcc -o test test_1.c test_2.c test_3.c

三、直接运行,可以直接看到效果

./test

makefile 的制作方法:

1、了解makefile的语法

建立makefile,并且加入一下的内容

main:test_1.o test_2.o test_3.o

gcc -o test test_1.o test_2.o test_3.o

clean:

rm -rf test_1.o test_2.o test_3.o

2、make #注意这里   make其实是gun下的一个工具,在加入了之后会自动的将.c的文件进行gcc的操作,具体的效果如下:

cc    -c -o test_1.o test_1.c

cc    -c -o test_2.o test_2.c

cc    -c -o test_3.o test_3.c

gcc -o test test_1.o test_2.o test_3.o

3、make clean #将生成的编译文件给自动的删除掉

rm -rf test_1.o test_2.o test_3.o

4、make clean test   #进行检测 源码是否有变化

rm -rf test_1.o test_2.o test_3.o

make: Nothing to be done for `test'.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值