You need to add #include <netinet/in.h>
Why doesn't struct declaration compile in Android NDK?
-
21-07-2023 - |
Question
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;
^
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow