print "hello world"

来源:互联网 发布:mac retina 13寸壁纸 编辑:程序博客网 时间:2024/05/17 12:02

print_str.h

#ifndef __PRINT_STR_H__#define __PRINT_STR_H__void print_string(char *str);#endif //__PRINT_STR_H__

print_str.c

#include <stdio.h>#include "print_str.h"void print_str(char *str){printf("%s\n", str);}

helloworld.c

#include <stdio.h>#include "print_str.h"int main(){print_str("hello world");return 0;}

Makefile

OBJS = helloworld.o print_str.oCC=gccTARGET=helloworld.PHONY: $(TARGET)$(TARGET): $(OBJS)    $(CC) -o helloworld $(OBJS)$(OBJS):%.o: %.c    $(CC) -c $(CFLAGS) $< -o $@.PHONY: cleanclean:    -rm -v *.o helloworld


0 0
原创粉丝点击