c++ - IN_ADDR struct strangely defined in android -
i trying compile networking code on android , seeing compilation errors. struct using is ip_mreq_source should defined in header so:
struct ip_mreq_source { struct in_addr imr_multiaddr; struct in_addr imr_sourceaddr; struct in_addr imr_interface; };
where in_addr should defined as:
typedef uint32_t in_addr_t; struct in_addr { in_addr_t s_addr; };
my detailed error coming out of g++ (gcc 4.4.3) android based compiler:
arm-linux-androideabi-g++ -mmd -mp -mf groupsock/groupsockhelper.o.d.org -fpic -ffunction-sections -funwind-tables -fstack-protector -d__arm_arch_5__ -d__arm_arch_5t__ -d__arm_arch_5e__ -d__arm_arch_5te__ -wno-psabi -march=armv5te -mtune=xscale -msoft-float -fno-exceptions -fno-rtti -mthumb -os -fomit-frame-pointer -fno-strict-aliasing -finline- limit=64 -igroupsock/include -igroupsock/../usageenvironment/include -iandroid- ndk-r5b/sources/cxx-stl/system/include -igroupsock -dandroid -wa,--noexecstack -dandroid_ndk -wall -fexceptions -o2 -dndebug -g -iandroid-8/arch-arm/usr/include -c groupsock/groupsockhelper.cpp -o groupsock/groupsockhelper.o && rm -f groupsock/groupsockhelper.o.d && mv groupsock/groupsockhelper.o.d.org groupsock/groupsockhelper.o.d groupsock/groupsockhelper.cpp: in function 'boolean socketjoingroupssm(usageenvironment&, int, netaddressbits, netaddressbits)': groupsock/groupsockhelper.cpp:427: error: request member 's_addr' in 'imr.ip_mreq_source::imr_multiaddr', of non-class type '__u32' groupsock/groupsockhelper.cpp:428: error: request member 's_addr' in 'imr.ip_mreq_source::imr_sourceaddr', of non-class type '__u32' groupsock/groupsockhelper.cpp:429: error: request member 's_addr' in 'imr.ip_mreq_source::imr_interface', of non-class type '__u32'
i not sure causing error. pointers great - no pun intended. thanks
thanks everyone's help. able track down error different struct definitions in versions of include files android g++ compiler using.
turns out android platform g++ include files quite restricted. definitions of structs in these headers of form:
struct in_addr { __u32 s_addr; };
and:
struct ip_mreq_source { __u32 imr_multiaddr; __u32 in_addr imr_sourceaddr; int some_other_var };
so struct2, struct3 , struct4 __u32 (unsigned ints defined in asm/types.h) , not structs in old version. solve issue, changed usage to:
struct struct1 st1; st1.struct2 = value
instead of:
struct struct1 st1; st1.struct2.s = value;
thanks leading me right way though.
;
Comments
Post a Comment