中国IT动力,最新最全的IT技术教程
最新100篇 | 推荐100篇 | 专题100篇 | 排行榜 | 搜索 | 在线API文档
首 页 | 程序开发 | 操作系统 | 软件应用 | 图形图象 | 网络应用 | 精文荟萃 | 教育认证 | 硬件维护 | 未整理篇 | 站长教程
ASP JS PHP工程 ASP.NET 网站建设 UML J2EESUN .NET VC VB VFP 网络维护 数据库 DB2 SQL2000 Oracle Mysql
服务器 Win2000 Office C DreamWeaver FireWorks Flash PhotoShop 上网宝典 CorelDraw 协议大全 网络安全 微软认证
硬件维护  CPU  主板  硬盘  内存  显卡  显示器  键盘鼠标  声卡音箱  打印机  机箱电源  BIOS  网卡  C#  Java  Delphi  vs.net2005
  当前位置:> 程序开发 > 编程语言 > C/C++
检查daytimetcpcli.c有一大堆的错误??
作者:未知 时间:2005-09-13 23:29 出处:Blog.ChinaUnix.net 责编:chinaitpower
              摘要:检查daytimetcpcli.c有一大堆的错误??

unp的问题


你是用的W.Richard.Stevens的unix programming 吧,他的unp头文件里面的函数分别实现在一些文件里面。
你用unp的话,要把那几个文件夹也放到你的user path里面去就好了。
 谢谢大家,原来是注释那里弄重复了/* /* some */*/

请问怎么得到config.h文件。我照着书去下载,不行哦。

 这是源程序:

#include "unp.h"
int
main(int argc,char **argv)
{
    int                     sockfd,n;
    char                    recvline[MAXLINE+1];
    struct sockaddr_in      servaddr;
    if(argc != 2) {
          printf("Usage : %s <IPaddress>\n",argv[0]);
          return(1);
    }
    if((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) {
          printf("create socket error\n");
          return(1);
    }
    bzero(&servaddr,sizeof(servaddr));
    servaddr.sin_family=AF_INET;
    servaddr.sin_port=htons(13);
    if(inet_pton(AF_INET,argv[1],&servaddr.sin_addr) <= 0) {
          printf("inet_pton error\n");
          retrun(1);
    }
    if(connect(sockfd,(struct sockaddr *)&servaddr,sieof(servaddr))<0) {
          printf("connect error\n");
          return(1);
    }
    while((n=read(sockfd,recvline,MAXLINE))>0) {
          recvline[n]=0;    /* null terminate */
          if(fputs(recvline,stdout) == EOF ) {
                 printf("fputs error\n");
                 return(1);
          }
    }
    if(n<0) {
          printf("read error\n");
          return(1);
    }
    return(0);
}

 
un.h我是照着书抄的,估计没问题。以下是错误。@@@@@@

In file included from daytimetcpcli.c:1:
/usr/include/unp.h:10: syntax error before `/'
In file included from /usr/include/sys/inttypes.h:9,
                 from /usr/include/sys/types.h:48,
                 from /usr/include/unp.h:15,
                 from daytimetcpcli.c:1:
/usr/include/machine/ansi.h:146: syntax error before `__int64_t'
In file included from /usr/include/sys/types.h:48,
                 from /usr/include/unp.h:15,
                 from daytimetcpcli.c:1:
/usr/include/sys/inttypes.h:14: syntax error before `int64_t'
/usr/include/sys/inttypes.h:14: warning: data definition has no type or storage class
In file included from /usr/include/sys/types.h:49,
                 from /usr/include/unp.h:15,
                 from daytimetcpcli.c:1:
/usr/include/machine/types.h:51: syntax error before `vm_ooffset_t'
/usr/include/machine/types.h:51: warning: data definition has no type or storage class
In file included from /usr/include/unp.h:15,
                 from daytimetcpcli.c:1:
/usr/include/sys/types.h:66: syntax error before `quad_t'
/usr/include/sys/types.h:66: warning: data definition has no type or storage class
/usr/include/sys/types.h:67: syntax error before `*'
/usr/include/sys/types.h:67: warning: data definition has no type or storage class
/usr/include/sys/types.h:82: syntax error before `off_t'
/usr/include/sys/types.h:82: warning: data definition has no type or storage class
/usr/include/sys/types.h:84: syntax error before `rlim_t'
/usr/include/sys/types.h:84: warning: data definition has no type or storage class
In file included from /usr/include/unp.h:15,
                 from daytimetcpcli.c:1:
/usr/include/sys/types.h:198: syntax error before `off_t'
/usr/include/sys/types.h:202: syntax error before `lseek'
/usr/include/sys/types.h:202: syntax error before `off_t'
/usr/include/sys/types.h:202: warning: data definition has no type or storage class
/usr/include/sys/types.h:206: syntax error before `off_t'
/usr/include/sys/types.h:210: syntax error before `off_t'
In file included from /usr/include/unp.h:16,
                 from daytimetcpcli.c:1:
/usr/include/sys/socket.h:191: syntax error before `int64_t'
/usr/include/sys/socket.h:451: syntax error before `off_t'
In file included from /usr/include/unp.h:17,
                 from daytimetcpcli.c:1:
/usr/include/sys/time.h:147: syntax error before `int64_t'
In file included from /usr/include/unp.h:22,
                 from daytimetcpcli.c:1:
/usr/include/fcntl.h:181: syntax error before `off_t'
In file included from /usr/include/unp.h:25,
                 from daytimetcpcli.c:1:
/usr/include/stdio.h:55: syntax error before `fpos_t'
/usr/include/stdio.h:55: warning: data definition has no type or storage class
/usr/include/stdio.h:110: syntax error before `fpos_t'
/usr/include/stdio.h:127: syntax error before `fpos_t'
/usr/include/stdio.h:207: syntax error before `fpos_t'
/usr/include/stdio.h:217: syntax error before `*'
/usr/include/stdio.h:306: syntax error before `__int64_t'
/usr/include/stdio.h:307: syntax error before `ftello'
/usr/include/stdio.h:307: warning: data definition has no type or storage class
/usr/include/stdio.h:339: syntax error before `fpos_t'
/usr/include/stdio.h:339: syntax error before `fpos_t'
/usr/include/stdio.h:339: `funopen' declared as function returning a function
In file included from /usr/include/unp.h:26,
                 from daytimetcpcli.c:1:
/usr/include/stdlib.h:186: syntax error before `strtoq'
/usr/include/stdlib.h:186: warning: data definition has no type or storage class
In file included from /usr/include/unp.h:28,
                 from daytimetcpcli.c:1:
/usr/include/sys/stat.h:99: syntax error before `off_t'
/usr/include/sys/stat.h:105: syntax error before `int64_t'
/usr/include/sys/stat.h:129: syntax error before `off_t'
/usr/include/sys/stat.h:134: syntax error before `int64_t'
In file included from /usr/include/unp.h:30,
                 from daytimetcpcli.c:1:
/usr/include/unistd.h:135: syntax error before `off_t'
/usr/include/unistd.h:143: syntax error before `off_t'
/usr/include/unistd.h:145: syntax error before `off_t'
/usr/include/unistd.h:186: syntax error before `__syscall'
/usr/include/unistd.h:186: syntax error before `...'
/usr/include/unistd.h:186: warning: data definition has no type or storage class
In file included from daytimetcpcli.c:1:
/usr/include/unp.h:376: syntax error before `

 还是好好检查一下unp.h有什么打字错误。

 是你自己的问题,试着不用老大给的函数,用自己的写个呢

关闭本页
 
首页 | 投资与合作 | 服务条款 | 隐私政策 | 收藏本站 | 设为首页 | 新用户注册 | 免责声明 | 使用帮助
Copyright ©2005-2008 chinaitpower.com All rights reserved. www.chinaitpower.com 版权所有