为什么不在Android NDK中编译struct declaration?

时间:2014-05-12 20:03:10

标签: android c++ c struct android-ndk

如何使用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;
                   ^

1 个答案:

答案 0 :(得分:4)

您需要添加#include <netinet/in.h>