在Linux下编译APUE的例子
所有例子在
linux-2.6.29.3
(
gcc-4.3.3
)下编译通过,需要做的修改如下:
l
打开apue.2e
文件夹下的Make.defines.linux
文件(根据你的系统选择对应文件),修改WKDIR=/home/var/apue.2e
为你的apue.2e
目录,如WKDIR=/home/pydeng/apue.2e
。
l
然后进入apue.2e/std
目录,编辑linux.mk
,修改里面所有的nawk
为awk
。
l
修改脚本文件systype.sh
的权限,给当前用户及其所在组和其他组添加可执行权限。(有些可无)
l
返回apue.2e
目录,执行make
命令。
l
在编译apue.2e/threadctl/getenv1.c
时,报告ARG_MAX
没有定义。在linux-2.6.X
下,ARG_MAX
被定义在/usr/include/linux/limit.h
文件里面。于是,将getenv1.c
和getenv3.c
文件的include
改成#include <linux/limit.h>
。
l
再次make
,报告threads/badexit2.c
文件的31
行存在类型不匹配。将pthread_self()
的返回值强制转换成int
。
l
执行make
,顺利编译所有文件。
l
要在apue.2e
子目录下单独编译一个文件,需要对头文件apue.h
的路径作相对修改,如改为#include "../include/apue.h"
。另一种办法是,直接将apue.h
拷贝到/usr/include
下面。然后执行类似下面的命令。libapue.a
库实现了apue.h
中声明的函数。
pydeng@pydeng-laptop:~/apue.2e/file$ gcc –o ls1 ls1.c ../lib/libapue.a
l
Enjoy yourself
:)
2009-11-19
相关文档:
1. HCI层协议概述:
HCI提供一套统一的方法来访问Bluetooth底层。如图所示:
从图上可以看出,Host Controller Interface(HCI) 就是用来沟通Host和Module。Host通常就是PC, Module则是以各种物理连接形式(USB,serial,pc-card等)连接到PC上的bluetooth Dongle。
在Host这一端:application,SDP,L2cap等协议 ......
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
首先申明,我是菜鸟.菜到什么程度,大家看看下面的代码.
代码要求:取得1000次单独创建进程的时间.
[code:1:fdac913669]#include
#include
#include
#include
#include
strut timeval {
long tv_sec; /* 秒数 */
long tv_usec; /* 微秒数  ......
How to change the hostname of a Linux system
Normally we will set the hostname of a system during the installation process. Many peoples don’t care about this, and don’t change the hostname even if for example this was set to something really stupid by the datacenter that installed the ......
用GCC开发linux应用程序(经典)
2009年11月01日 星期日 23:58
作为自由软件的旗舰项目,Richard Stallman 在十多年前刚开始写作 GCC 的时候,还只是把它当作仅仅一个 C程序语言的编译器;GCC 的意思也只是 GNU C Compiler 而已。经过了这么多年的发展,GCC 已经不仅仅能支持 C语言;它现在还支持 Ada 语言、C++ 语言、Ja ......