문제

How can a struct be compiled with Android NDK?

The following declaration (works fine with 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;

gives the error:

error: field 'serv_addr' has incomplete type
struct sockaddr_in serv_addr;
                   ^
도움이 되었습니까?

해결책

You need to add #include <netinet/in.h>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top