在 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, char *buf, int nbyte ) );
#endif
我试图删除第二个参数,但我得到另一个错误,说函数“gettimeofday”的参数太多。
我该如何解决?