gcc -std=c99 -Wall -Wextra -O3 -pthread -c dns2tcp.c -o dns2tcp.o
dns2tcp.c: In function ‘main’:
dns2tcp.c:179:44: error: incompatible type for argument 2 of ‘uv_udp_bind’
int retval = uv_udp_bind(g_udp_server, (void *)&g_listen_skaddr, (g_listen_skaddr.sin6_family == AF_INET) ? 0 : UV_UDP_IPV6ONLY);
^
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:832:15: note: expected ‘struct sockaddr_in’ but argument is of type ‘void *’
UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
^~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c:181:68: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[main] bind failed: (%d) %s", -retval, uv_strerror(retval));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘int’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
dns2tcp.c:184:37: warning: passing argument 2 of ‘uv_udp_recv_start’ from incompatible pointer type [-Wincompatible-pointer-types]
uv_udp_recv_start(g_udp_server, udp_alloc_cb, udp_recv_cb);
^~~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:973:15: note: expected ‘uv_alloc_cb {aka struct <anonymous> (*)(struct uv_handle_s *, long unsigned int)}’ but argument is of type ‘void (*)(uv_handle_t *, size_t, uv_buf_t *) {aka void (*)(struct uv_handle_s *, long unsigned int, struct <anonymous> *)}’
UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
^~~~~~~~~~~~~~~~~
dns2tcp.c:184:51: warning: passing argument 3 of ‘uv_udp_recv_start’ from incompatible pointer type [-Wincompatible-pointer-types]
uv_udp_recv_start(g_udp_server, udp_alloc_cb, udp_recv_cb);
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:973:15: note: expected ‘uv_udp_recv_cb {aka void (*)(struct uv_udp_s *, long int, struct <anonymous>, struct sockaddr *, unsigned int)}’ but argument is of type ‘void (*)(uv_udp_t *, ssize_t, const uv_buf_t *, const skaddr_t *, unsigned int) {aka void (*)(struct uv_udp_s *, long int, const struct <anonymous> *, const struct sockaddr *, unsigned int)}’
UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
^~~~~~~~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c: In function ‘udp_recv_cb’:
dns2tcp.c:199:75: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[udp_recv_cb] recv failed: (%zd) %s", -nread, uv_strerror(nread));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘ssize_t {aka long int}’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
dns2tcp.c:232:54: error: incompatible type for argument 3 of ‘uv_tcp_connect’
int retval = uv_tcp_connect(connreq, tcp_client, (void *)&g_remote_skaddr, tcp_connect_cb);
^
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:745:15: note: expected ‘struct sockaddr_in’ but argument is of type ‘void *’
UV_EXTERN int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle,
^~~~~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c:234:78: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[udp_recv_cb] connect failed: (%d) %s", -retval, uv_strerror(retval));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘int’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c: In function ‘tcp_connect_cb’:
dns2tcp.c:252:81: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[tcp_connect_cb] connect failed: (%d) %s", -status, uv_strerror(status));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘int’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c:265:79: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[tcp_connect_cb] write failed: (%d) %s", -status, uv_strerror(status));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘int’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c: In function ‘tcp_write_cb’:
dns2tcp.c:281:77: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[tcp_write_cb] write failed: (%d) %s", -status, uv_strerror(status));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘int’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
dns2tcp.c:287:31: warning: passing argument 2 of ‘uv_read_start’ from incompatible pointer type [-Wincompatible-pointer-types]
uv_read_start(tcp_client, tcp_alloc_cb, tcp_read_cb);
^~~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:618:15: note: expected ‘uv_alloc_cb {aka struct <anonymous> (*)(struct uv_handle_s *, long unsigned int)}’ but argument is of type ‘void (*)(uv_handle_t *, size_t, uv_buf_t *) {aka void (*)(struct uv_handle_s *, long unsigned int, struct <anonymous> *)}’
UV_EXTERN int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb,
^~~~~~~~~~~~~
dns2tcp.c:287:45: warning: passing argument 3 of ‘uv_read_start’ from incompatible pointer type [-Wincompatible-pointer-types]
uv_read_start(tcp_client, tcp_alloc_cb, tcp_read_cb);
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:618:15: note: expected ‘uv_read_cb {aka void (*)(struct uv_stream_s *, long int, struct <anonymous>)}’ but argument is of type ‘void (*)(uv_stream_t *, ssize_t, const uv_buf_t *) {aka void (*)(struct uv_stream_s *, long int, const struct <anonymous> *)}’
UV_EXTERN int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb,
^~~~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c: In function ‘tcp_read_cb’:
dns2tcp.c:301:96: error: incompatible type for argument 1 of ‘uv_strerror’
if (nread != UV_EOF) LOGERR("[tcp_read_cb] read failed: (%zd) %s", -nread, uv_strerror(nread));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘ssize_t {aka long int}’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
dns2tcp.c:339:13: warning: implicit declaration of function ‘uv_udp_try_send’ [-Wimplicit-function-declaration]
nread = uv_udp_try_send(g_udp_server, uvbufs, 1, (void *)&tcp_data->srcaddr);
^~~~~~~~~~~~~~~
In file included from dns2tcp.c:2:0:
dns2tcp.c:341:75: error: incompatible type for argument 1 of ‘uv_strerror’
LOGERR("[tcp_read_cb] send failed: (%zd) %s", -nread, uv_strerror(nread));
^
logutils.h:24:19: note: in definition of macro ‘LOGERR’
##__VA_ARGS__); \
^~~~~~~~~~~
In file included from dns2tcp.c:4:0:
/usr/include/uv.h:450:23: note: expected ‘uv_err_t {aka struct uv_err_s}’ but argument is of type ‘ssize_t {aka long int}’
UV_EXTERN const char* uv_strerror(uv_err_t err);
^~~~~~~~~~~
Makefile:26: recipe for target 'dns2tcp.o' failed
make: *** [dns2tcp.o] Error 1
环境信息: