#include <netlink/socket.h>
#include <netlink/netlink.h>
struct nl_sock *sock;
sock = nl_socket_alloc();
上面的代码总是无法编译并出现以下错误:/home/micah/Documents/C++/Socket_fun/Socket_fun/src/main.cpp|5|error: 'sock' does not name a type
我从 libnl 示例中得到了这个,因为它不起作用,我想知道,正确的方法是什么?