不知道如何运行unix网络编程下面的代码

    最近下了本电子书,unix网络编程,我的安装的操作系统是CentOS 5.5  ,把源代码导入之后,按照着readme.txt那个说明编译运行了一遍,发现有些报错内容,忽略过去了,但是就是运行第一个程序的时候就报错,非常郁闷:

[root@localhost intro]# ./daytimetcpcli1 127.0.0.1
-bash: ./daytimetcpcli1: No such file or directory
[root@localhost intro]# ./daytimetcpcli 127.0.0.1
connect error: Connection refused

本来是想学C语言的网络编程的,但是第一个程序就跑不起来,对我的打击相当的大啊,在网上找了半天也没有详细的说明如何用里面的方法,都是很大牛的口气告诉新手,直接改代码吧。。。让我很是无奈。。。
我只知道用C写的源文件可以用gcc来编译,但是里面的源代码我用GCC这个命令来编译,就报一大堆的错,相当的郁闷。。。

[root@localhost intro]# ./daytimetcpcli1.c 127.0.0.1
./daytimetcpcli1.c: line 3: int: command not found
./daytimetcpcli1.c: line 4: syntax error near unexpected token `int'
./daytimetcpcli1.c: line 4: `main(int argc, char **argv)'
[root@localhost intro]# gcc daytimetcpcli1.c 
daytimetcpcli1.c:1:17: error: unp.h: No such file or directory
daytimetcpcli1.c: In function amaina:
daytimetcpcli1.c:7: error: aMAXLINEa undeclared (first use in this function)
daytimetcpcli1.c:7: error: (Each undeclared identifier is reported only once
daytimetcpcli1.c:7: error: for each function it appears in.)
daytimetcpcli1.c:8: error: storage size of aservaddra isnat known
daytimetcpcli1.c:13: error: aAF_INETa undeclared (first use in this function)
daytimetcpcli1.c:13: error: aSOCK_STREAMa undeclared (first use in this function)
daytimetcpcli1.c:16: warning: incompatible implicit declaration of built-in function abzeroa
daytimetcpcli1.c:22: error: aSAa undeclared (first use in this function)
daytimetcpcli1.c:22: error: expected expression before a)a token
daytimetcpcli1.c:28: error: astdouta undeclared (first use in this function)
daytimetcpcli1.c:28: error: aEOFa undeclared (first use in this function)
daytimetcpcli1.c:34: warning: incompatible implicit declaration of built-in function aprintfa
daytimetcpcli1.c:35: warning: incompatible implicit declaration of built-in function aexita
    
我准备下个FreeBSD来试试,莫非是操作系统的版本不对的问题吗。。。
总之,这次尝试是让我相当的不开心啊
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值