编译 MUD 时如何修复“gettimeofday”的冲突类型?

问题描述

在 Ubuntu 机器上尝试使用 make 编译 MUD 的代码库时,出现以下错误

comm.c:184:5: error: conflicting types for ‘gettimeofday’
  184 | int gettimeofday args( ( struct timeval *tp,struct timezone *tzp ) );
      |     ^~~~~~~~~~~~
In file included from comm.c:56:
/usr/include/x86_64-linux-gnu/sys/time.h:66:12: note: prevIoUs declaration of ‘gettimeofday’ was here
   66 | extern int gettimeofday (struct timeval *__restrict __tv,|            ^~~~~~~~~~~~

这是错误来自的代码片段:

#if defined(linux)
/*int   accept      args( ( int s,struct sockaddr *addr,int *addrlen
) );*/
/*int   bind        args( ( int s,struct sockaddr *name,int namelen
) );*/
int close       args( ( int fd ) );
int gettimeofday    args( ( struct timeval *tp,struct timezone *tzp ) );
int listen      args( ( int s,int backlog ) );
int read        args( ( int fd,char *buf,int nbyte ) );
int select      args( ( int width,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,struct timeval *timeout ) );
int socket      args( ( int domain,int type,int protocol ) );
int write       args( ( int fd,int nbyte ) );
#endif

我已尝试删除第二个参数,但我收到另一个错误,指出函数“gettimeofday”的参数过多。

我该如何解决这个问题?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...