OpenWrt Forum Archive

Topic: "__BYTE_ORDER" is not defined?

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

?am compiling a module on kamikaze 8.09 including code like:
**********************************************************
#if __BYTE_ORDER == __LITTLE_ENDIAN
    u_int8_t res:7;
    u_int8_t s:1;
#elif __BYTE_ORDER == __BIG_ENDIAN
    u_int8_t s:1;
    u_int8_t res:7;
#endif
    u_int16_t check;
    u_int32_t daddr;
************************************************************

I have include <asm/byteorder.h>, but error "__BYTE_ORDER" is not defined happened. I cannot solve it , anyone can help? Thanks!

#include <endian.h>

instead.

chrism238 wrote:

#include <endian.h>

instead.

It says  " error: endian.h: No such file or directory"



I change the code like:
***************************************
    u_int8_t protocol;
#ifdef LITTLE_ENDIAN
    u_int8_t res:7;
    u_int8_t s:1;
#else
    u_int8_t s:1;
    u_int8_t res:7;
#endif
**************************************

seems work!

The discussion might have continued from here.