How do I fix conflicting types for 'gettimeofday' when compiling a MUD?

1k Views Asked by At

While trying to compile a MUD's codebase with make on an Ubuntu machine I get the following error:

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,
      |            ^~~~~~~~~~~~

This is a code snippet from where the error comes from:

#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

I've tried to remove the second parameter, but I get another error that says that there are too many arguments to the function 'gettimeofday'.

How do I fix this?

0

There are 0 best solutions below