/tmp/cc4QQlah.o:在函数‘main’中: web.c:(.text+0x255):对‘peeror’未定义的引用

在尝试编译一个包含socket和线程功能的C语言程序时,遇到链接错误提示:/tmp/cc4QQlah.o: 在函数'main'中:web.c:(.text+0x255): 对'peeror'未定义的引用。这通常意味着在源代码中使用了一个未声明或者未正确链接的函数'peeror'。解决方法包括检查函数声明、库链接设置以及确保所有必要的源文件都被编译和链接。
摘要由CSDN通过智能技术生成
root@wangmiao:~/lesson# vim web.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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值