易截截图软件、单文件、免安装、纯绿色、仅160KB

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

包含3个文件夹,和一个文件Makefile
目录组织结构如下:
Makefile
inc/hello.h
main/main.c
src/hello.c
Makefile文件在外面,这样生成的.o和可执行文件都在外面,clean之后会很干净,结构清晰
文件内容如下:
Makefile(之所以用大写,因为make可以识别Makefile和makefile,用大写可以鲜明一些)::
# String declaration
objects = main.o hello.o
# Command
app : $(objects)
cc -o app $(objects)
main.o : main/main.c hello.h
cc -c main/main.c
hello.o : src/hello.c stdio.h
cc -c src/hello.c
# Search paths
vpath %.h /usr/include inc
# Clean the intermediate files
.PHONY : clean
clean :
rm app $(objects)

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;
}
其中,第二个包含文件,hello.h,必须要用"",如果用<>则gcc只会到系统目录下去搜索,不会到本当前目录下搜索
就是""在用户目录下,<>在系统目录下,这个在windows上不严格, 在linux里似乎很严格
hello.c:
#include <stdio.h>
void hello(char name[])
{
printf("Hello %s!\n", name);
}


相关文档:

关于linux的几个远程控制的软件

putty
putty是个比较简单的linux远程控制工具,免费的,只要下到putty运行就ok啦,输入要访问的服务器的ip ,把访问类型设为ssh,输入登陆帐户、密码就ok啦,一切都是那么的简单。 
secureCRT
这个比较复杂一点,需要注册码的,但还算是比较容易找到的,它的设置也是很傻瓜的那种,跟putty是一样的,把访问的类型设 ......

linux定时器设置

10.5.2 精通定时器设置
函数alarm设置的定时器只能精确到秒,而以下函数理论上可以精确到微妙:
#include  <sys/select.h>
#include  <sys/itimer.h>
int getitimer(int which, struct itimerval *value);
int setitimer(int which, const struct itimerval
*value, struct itimerval *ovalue ......

linux驱动之makefile详解

# If KERNELRELEASE is defined, we've been invoked from the
# kernel build system and can use its language.
ifneq ($(KERNELRELEASE),)
    obj-m := hello.o
# Otherwise we were called directly from the command
# line; invoke the kernel build system.
else
    ......

Linux GCC make文件的写法3

 包含3个文件夹
目录组织结构如下:
inc/hello.h
main/main.c, Makefile
src/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 Ub ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号