Android中使用unix本地套接字编程 编译问题

因工作需要,需要用到socket网络编程的内容,在调试时从提示下面错误:

bionic/libc/kernel/common/linux/un.h:18: error: expected specifier-qualifier-list before ‘sa_family_t’

error: ‘struct sockaddr_un’ has no member named ‘sun_family’


后来发现是头文件顺序错了,#include <sys/socket.h>应该写在#include <linux/un.h>的前面,就可以编译通过了。

猜你喜欢

转载自blog.csdn.net/zhangxu1024/article/details/8819265