root@wangmiao:~/lesson# vim web.c
root@wangmiao:~/lesson# vim wrap.h
root@wangmiao:~/lesson# vim wrap.c
root@wangmiao:~/lesson# vim wrap.h
root@wangmiao:~/lesson# vim wrap.c
root@wangmiao:~/lesson# gcc web.c wrap.c -o web
web.c:9:20: fatal error: singnal.h: 没有那个文件或目录
#include<singnal.h>
^
compilation terminated.
wrap.c: In function ‘Accept’:
wrap.c:19:16: error: ‘ECONNABORTTED’ undeclared (first use in this function)
if((errno == ECONNABORTTED)||(errno == EINTR))
^
wrap.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
wrap.c: In function ‘Read’:
wrap.c:70:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c: In function ‘Write’:
wrap.c:87:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c: In function ‘my_read’:
wrap.c:176:3: error: ‘ptr’ undeclared (first use in this function)
*ptr = *read_ptr++;
^
root@wangmiao:~/lesson# vim web.c
root@wangmiao:~/lesson# vim wrap.c
root@wangmiao:~/lesson# gcc web.c wrap.c -o web
In file included from web.c:11:0:
wrap.h:6:44: error: unknown type name ‘socklent_t’
void Bind(int fd,const struct sockaddr *sa,socklent_t salen);
^
web.c: In function ‘http_send’:
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 3 has type ‘char *’ [-Wformat=]
len = sprintf(HTTP_INFO,"%S%S",HTTP_HEADER,content);
^
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ [-Wformat=]
web.c: In function ‘main’:
web.c:54:2: error: ‘listendfd’ undeclared (first use in this function)
listendfd = Socket(AF_INET,SOCK_STREAM,0);
^
web.c:54:2: note: each undeclared identifier is reported only once for each function it appears in
web.c:55:25: error: ‘seraddr’ undeclared (first use in this function)
bzero(&servaddr,sizeof(seraddr));
^
web.c:61:22: error: ‘SOL_SOKET’ undeclared (first use in this function)
setsockopt(listenfd,SOL_SOKET,SO_REUSEADDR,&opt,sizeof(opt));
^
web.c:87:103: error: ‘cli_addr’ undeclared (first use in this function)
printf("received from %s at PORT %d \n",inet_ntop(AF_INET,&cliaddr.sin_addr,str,sizeof(str)),ntohs(cli_addr.sin_port));
^
wrap.c: In function ‘Write’:
wrap.c:87:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c:87:6: note: each undeclared identifier is reported only once for each function it appears in
root@wangmiao:~/lesson# vim web.c
root@wangmiao:~/lesson# gcc web.c wrap.c -o -webone
In file included from web.c:11:0:
wrap.h:6:44: error: unknown type name ‘socklent_t’
void Bind(int fd,const struct sockaddr *sa,socklent_t salen);
^
web.c: In function ‘http_send’:
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 3 has type ‘char *’ [-Wformat=]
len = sprintf(HTTP_INFO,"%S%S",HTTP_HEADER,content);
^
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ [-Wformat=]
web.c: In function ‘main’:
web.c:54:2: error: ‘listendfd’ undeclared (first use in this function)
listendfd = Socket(AF_INET,SOCK_STREAM,0);
^
web.c:54:2: note: each undeclared identifier is reported only once for each function it appears in
web.c:55:25: error: ‘seraddr’ undeclared (first use in this function)
bzero(&servaddr,sizeof(seraddr));
^
web.c:61:22: error: ‘SOL_SOKET’ undeclared (first use in this function)
setsockopt(listenfd,SOL_SOKET,SO_REUSEADDR,&opt,size
web.c:9:20: fatal error: singnal.h: 没有那个文件或目录
#include<singnal.h>
^
compilation terminated.
wrap.c: In function ‘Accept’:
wrap.c:19:16: error: ‘ECONNABORTTED’ undeclared (first use in this function)
if((errno == ECONNABORTTED)||(errno == EINTR))
^
wrap.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
wrap.c: In function ‘Read’:
wrap.c:70:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c: In function ‘Write’:
wrap.c:87:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c: In function ‘my_read’:
wrap.c:176:3: error: ‘ptr’ undeclared (first use in this function)
*ptr = *read_ptr++;
^
root@wangmiao:~/lesson# vim web.c
root@wangmiao:~/lesson# vim wrap.c
root@wangmiao:~/lesson# gcc web.c wrap.c -o web
In file included from web.c:11:0:
wrap.h:6:44: error: unknown type name ‘socklent_t’
void Bind(int fd,const struct sockaddr *sa,socklent_t salen);
^
web.c: In function ‘http_send’:
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 3 has type ‘char *’ [-Wformat=]
len = sprintf(HTTP_INFO,"%S%S",HTTP_HEADER,content);
^
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ [-Wformat=]
web.c: In function ‘main’:
web.c:54:2: error: ‘listendfd’ undeclared (first use in this function)
listendfd = Socket(AF_INET,SOCK_STREAM,0);
^
web.c:54:2: note: each undeclared identifier is reported only once for each function it appears in
web.c:55:25: error: ‘seraddr’ undeclared (first use in this function)
bzero(&servaddr,sizeof(seraddr));
^
web.c:61:22: error: ‘SOL_SOKET’ undeclared (first use in this function)
setsockopt(listenfd,SOL_SOKET,SO_REUSEADDR,&opt,sizeof(opt));
^
web.c:87:103: error: ‘cli_addr’ undeclared (first use in this function)
printf("received from %s at PORT %d \n",inet_ntop(AF_INET,&cliaddr.sin_addr,str,sizeof(str)),ntohs(cli_addr.sin_port));
^
wrap.c: In function ‘Write’:
wrap.c:87:6: error: ‘error’ undeclared (first use in this function)
if(error == EINTR)
^
wrap.c:87:6: note: each undeclared identifier is reported only once for each function it appears in
root@wangmiao:~/lesson# vim web.c
root@wangmiao:~/lesson# gcc web.c wrap.c -o -webone
In file included from web.c:11:0:
wrap.h:6:44: error: unknown type name ‘socklent_t’
void Bind(int fd,const struct sockaddr *sa,socklent_t salen);
^
web.c: In function ‘http_send’:
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 3 has type ‘char *’ [-Wformat=]
len = sprintf(HTTP_INFO,"%S%S",HTTP_HEADER,content);
^
web.c:34:2: warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ [-Wformat=]
web.c: In function ‘main’:
web.c:54:2: error: ‘listendfd’ undeclared (first use in this function)
listendfd = Socket(AF_INET,SOCK_STREAM,0);
^
web.c:54:2: note: each undeclared identifier is reported only once for each function it appears in
web.c:55:25: error: ‘seraddr’ undeclared (first use in this function)
bzero(&servaddr,sizeof(seraddr));
^
web.c:61:22: error: ‘SOL_SOKET’ undeclared (first use in this function)
setsockopt(listenfd,SOL_SOKET,SO_REUSEADDR,&opt,size