如何使用 Android NDK 编译结构体?
以下声明(适用于 g++)
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netdb.h>
#include <cstring>
#include <fstream>
#include <sstream>
//header construction here...
private:
struct sockaddr_in serv_addr;
给出错误:
error: field 'serv_addr' has incomplete type
struct sockaddr_in serv_addr;
^
最佳答案
您需要添加 #include <netinet/in.h>
关于android - 为什么在 Android NDK 中不编译结构声明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23617825/