Explicitly include <sys/socket.h>

server_config_dialog.cpp:57:30: error: member access into incomplete type 'struct sockaddr'
            if (ifa->ifa_addr->sa_family == AF_INET) { // check it is IP4
                             ^
/usr/local/include/qt5/QtNetwork/qhostaddress.h:50:8: note: forward declaration of 'sockaddr'
struct sockaddr;
       ^
server_config_dialog.cpp:61:27: error: use of undeclared identifier 'AF_INET'
                inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
                          ^
server_config_dialog.cpp:64:37: error: member access into incomplete type 'struct sockaddr'
            } else if (ifa->ifa_addr->sa_family == AF_INET6) { // check it is IP6
                                    ^
/usr/local/include/qt5/QtNetwork/qhostaddress.h:50:8: note: forward declaration of 'sockaddr'
struct sockaddr;
       ^
server_config_dialog.cpp:68:27: error: use of undeclared identifier 'AF_INET6'
                inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
                          ^
This commit is contained in:
Jan Beich 2019-11-26 14:11:40 +00:00 committed by Felix Kauselmann
parent 27f52df15c
commit 65a77daa75

View File

@ -38,6 +38,7 @@ bool ipComparator(const QString &ip1, const QString &ip2)
#include <sys/types.h>
#include <ifaddrs.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>