2010年3月17日

Linux GCC make文件的写法4--清晰版

摘要: 包含3个文件夹,和一个文件Makefile目录组织结构如下:Makefileinc/hello.hmain/main.csrc/hello.cMakefile文件在外面,这样生成的.o和可执行文件都在外面,clean之后会很干净,结构清晰文件内容如下:Makefile(之所以用大写,因为make可以识别Makefile和makefile,用大写可以鲜明一些)::# String declarationobjects = main.o hello.o# Commandapp : $(objects) cc -o app $(objects)main.o : main/main.c hello.h 阅读全文

posted @ 2010-03-17 16:15 yanhc 阅读(250) 评论(0) 推荐(0) 编辑

Linux GCC make文件的写法3

摘要: 包含3个文件夹目录组织结构如下:inc/hello.hmain/main.c, Makefilesrc/hello.c文件内容如下:hello.h:void hello(char name[]); main.c:#include <stdio.h>#include "../inc/hello.h"// The second hello.h should in ""int main(){ hello("GCC"); printf("Haha Linux Ubuntu!/n"); return 0;} 其中 阅读全文

posted @ 2010-03-17 16:07 yanhc 阅读(202) 评论(0) 推荐(0) 编辑

Linux GCC make文件的写法2

摘要: 文件在两个文件夹:inc/hello.hmain/hello.c, main.c, Makefile文件内容:hello.hvoid hello(char name[]); hello.c#include <stdio.h>void hello(char name[]){ printf("Hello %s!/n", name);} main.c#include <stdio.h>#include "../inc/hello.h"// The secondint main(){ hello("GCC"); pri 阅读全文

posted @ 2010-03-17 16:03 yanhc 阅读(208) 评论(0) 推荐(0) 编辑

Linux GCC make文件的写法1

摘要: 所需文件hello.c, main.c, hello.h, Makefile,在同一个目录下hello.c:#include <stdio.h>void hello(char name[]){ printf("Hello %s!/n", name);} main.c:#include "stdio.h"#include "hello.h"// The secondint main(){ hello("GCC"); printf("Haha Linux Ubuntu!/n"); ret 阅读全文

posted @ 2010-03-17 15:54 yanhc 阅读(237) 评论(0) 推荐(0) 编辑

导航