Linux. SOL_NETLINK未定义 [英] Linux. SOL_NETLINK not defined

查看:545
本文介绍了Linux. SOL_NETLINK未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Linux的setsockopt中使用SOL_NETLINK,但收到一条错误消息,尽管其中包含了socket.h文件,但未定义SOL_NETLINK.

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.

用Google搜索一些答案,由于"Linux标头文件混乱",人们看到人们在自己的文件中重新定义了SOL_NETLINK.

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

对此有任何解释吗?

推荐答案

我只是在树莓派PI上对代码进行了编译检查,并且编译时没有任何警告.

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;
}

这篇关于Linux. SOL_NETLINK未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆