Linux. SOL_NETLINK not defined

2020-02-14 03:20发布

I was trying to use SOL_NETLINK in setsockopt in Linux, and got an error saying that SOL_NETLINK is not defined although in included the socket.h file.

Googled for some answers and saw people redefine SOL_NETLINK in their own files due to "Linux header file confusion".

Any explanation for that?

标签: linux sockets
1条回答
劳资没心,怎么记你
2楼-- · 2020-02-14 03:32

I just compile-checked this code on a raspbian PI, and it compiles without any warnings.

#include <sys/socket.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
        printf ("SOL_SOCKET=%d\n", SOL_SOCKET);
        return 0;
}
查看更多
登录 后发表回答