asg*_*451 1 c linux ubuntu wifi
我一直在尝试使用 ioctl 来获取我的 wifi 连接状态,但遇到了一个问题:每当我这样做时#include <linux/wireless.h>,gcc 都会生成很多错误,例如
/usr/include/linux/wireless.h:869:18: error: field \xe2\x80\x98src_addr\xe2\x80\x99 has incomplete type\nstruct sockaddr src_addr;\n ^\n/usr/include/linux/wireless.h:880:18: error: field \xe2\x80\x98bssid\xe2\x80\x99 has incomplete type\nstruct sockaddr bssid;\n ^\nRun Code Online (Sandbox Code Playgroud)\n\n还有更多类似的。这是什么意思?我该怎么办?我在虚拟机中运行 Ubuntu 14.04 有关系吗?
\n\n如果有帮助的话,我的代码很简单:
\n\n#include <linux/wireless.h>\nint main() { return 0; }\nRun Code Online (Sandbox Code Playgroud)\n\n我正在编译gcc thing.c
谢谢。
\n您需要包含 sockaddr。您必须包括:
#include <netinet/in.h>
#include <sys/socket.h>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7015 次 |
| 最近记录: |