易截截图软件、单文件、免安装、纯绿色、仅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);
}


相关文档:

J2EE项目迁移(window >linux)

1. download & setup jdk
2. download eclipse and test a simple example of java
3. setup mysql use yum(or download & setup by hand)
 yum install mysql
 problem1:linux mysql configuration & use
  solution1:
   mysql -uroot -p
   passw ......

linux查找最近修改的文件 并只拿出文件名

在服务器上写部署项目的脚本 ,需要把上传来的最新的项目解压, 部署 ,启动服务 实现自动化
于是找到最新的文件是第一件事情
就得到了以下脚本
$ ls -lrt | awk '/xmhi/ { f=$NF };END{ print f }'
中间的xmhi是文件所包含的字符串
另外如果要ls出所有的文件名
$ ls -l |awk '{print$9}' ......

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下比较好用的chm阅读器和飞信软件

1、在linux下读微软标准的chm文件时,找了好久终于找了一款很不错的软件---KchmViewer
可以通过终端安装:
sudo apt-get install kchmViewer
使用ubuntu的朋友也可以在ubuntu软件中心安装。
2、LibeFetion非常好的第三方免费飞信软件,也有windows版本
官网主页:http://www.libfetion.org/index.php
真的非常好用 ......

Linux GCC make文件的写法2

文件在两个文件夹:
inc/hello.h
main/hello.c, main.c, Makefile
文件内容:
hello.h
void 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 second
int main( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号