Makefile文件一:简单的Makefile文件

测试一(最简单的makefile):

1. helloworld.cpp

#include <stdio.h>
int main()
{
	printf("Hello,world!\n");
	return 0;
}

2. Makefile(gcc前面和rm前面是tab键,不是空格(报错Makefile:2: *** missing separator.  Stop.))

hello_test:helloworld.cpp
	gcc helloworld.cpp -o helloworld
		
clean:
	rm helloworld

3.测试结果

测试二:多个文件组成的Makefile

1.源文件

test1.h和test1.cpp

///test1.h

#ifndef _TEST1_H_
#define _TEST1_H_
void test1_print(char* print_str);
#endif

//test1.cpp

#include <stdio.h>
#include "test1.h"

void test1_print(char* print_str)
{
	printf("test1:%s\n",print_str);
}

test2.h和test2.cpp

//test2.h

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值