LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 635|回复: 3

编译出错,能帮忙看看吗?

[复制链接]
发表于 2003-2-22 02:32:18 | 显示全部楼层 |阅读模式
今天到网上下了一个hztty-2.0,可是编译hztty-2.0时出错,具体情况如下。
在make linux 之后显示出错信息:
. . .      . . .
tty.c:487: void value not ignored as it ought to be


******        截取其中有用的部分   ******
... ...
struct utmp utmp;
... ...
486:  (void) strncpy ((char *)utmp.ut_id, ttydev + strlen(ttydev) - PTYCHLEN,
487:                          sizeof(utmp.ut_id));   <---提示此行出错


******   /usr/include/bits/utmp.h中关于对utmp结构类型的定义:   ******

struct utmp
{
.....
char ut_id[4];
...  ...
}


******   /usr/include/string.h中关于对strncpy函数的申明:   ******

/* Copy no more than N characters of SRC to DEST.  */
extern char *strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW;
发表于 2003-2-24 21:40:42 | 显示全部楼层
strncpy前面为什么要加上(void)
 楼主| 发表于 2003-2-25 15:15:37 | 显示全部楼层
最初由 hdw1978 发布
strncpy前面为什么要加上(void)


谢谢 hdw1978 大大的热心回文

请问是在/usr/include/string.h中

extern char *strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW;

变为

extern (void) char *strncpy (char *__restrict __dest, __const char *__restrict __src, size_t __n) __THROW;

可是这是系统带的头文件,改过去编译了再改回来可以吗?

谢谢!
发表于 2003-2-25 15:26:57 | 显示全部楼层
不要改系统的头文件,改你下的文件。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表