05月02, 2019

error

bot/scanner.c: In function ‘scanner_init’:
bot/scanner.c:250:36: error: ‘EAGAIN’ undeclared (first use in this function)
             if (n <= 0 || errno == EAGAIN || errno == EWOULDBLOCK)
                                    ^~~~~~
bot/scanner.c:250:36: note: each undeclared identifier is reported only once for each function it appears in
bot/scanner.c:250:55: error: ‘EWOULDBLOCK’ undeclared (first use in this function); did you mean ‘FNONBLOCK’?
             if (n <= 0 || errno == EAGAIN || errno == EWOULDBLOCK)
                                                       ^~~~~~~~~~~
                                                       FNONBLOCK
bot/scanner.c:414:33: error: ‘ECONNRESET’ undeclared (first use in this function); did you mean ‘ECANCELED’?
                         errno = ECONNRESET;
                                 ^~~~~~~~~~
                                 ECANCELED
bot/table.c: In function ‘table_retrieve_val’:

解决方案: 很容易 路径问题 /usr/include/asm-generic/errno-base.h

bot/main.c:248:37: error: ‘SOL_SOCKET’ undeclared (first use in this function); did you mean ‘SOL_PACKET’?
                 getsockopt(fd_serv, SOL_SOCKET, SO_ERROR, &err, &err_len);
                                     ^~~~~~~~~~
                                     SOL_PACKET
bot/main.c:248:37: note: each undeclared identifier is reported only once for each function it appears in
bot/main.c:248:49: error: ‘SO_ERROR’ undeclared (first use in this function); did you mean ‘MSG_EOR’?
                 getsockopt(fd_serv, SOL_SOCKET, SO_ERROR, &err, &err_len);
                                                 ^~~~~~~~
                                                 MSG_EOR
bot/main.c: In function ‘ensure_single_instance’:
bot/main.c:428:25: error: ‘SOL_SOCKET’ undeclared (first use in this function); did you mean ‘SOL_PACKET’?
     setsockopt(fd_ctrl, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (int));
                         ^~~~~~~~~~
                         SOL_PACKET
bot/main.c:428:37: error: ‘SO_REUSEADDR’ undeclared (first use in this function); did you mean ‘SI_USER’?
     setsockopt(fd_ctrl, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof (int));
                                     ^~~~~~~~~~~~
                                     SI_USER
bot/main.c: In function ‘main’:

解决方案:

#include "/usr/include/asm-generic/socket.h"

本文链接:https://harry.ren/post/error.html

-- EOF --

Comments