哪位高手帮小弟我编译一下这个文件?vc编译出错,而cygwin下没有关问题
谁帮我编译一下这个文件?vc编译出错,而cygwin下没问题
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#define MC_PCC_FILL_STRUCT3 u8:0; u8:8; u8:8; u8:8; u8:0;
typedef struct __alg { char c; MC_PCC_FILL_STRUCT3 void * p; } __alg_t;
#define MC_PPC_DISTANCE_OF(S,F) (unsigned) (&(((S *) 0)-> F))
#define ALIGNMENT (MC_PPC_DISTANCE_OF(__alg_t, p) - 1)
#define ALIGN(P) ( (u32) ((char *)(P) + ALIGNMENT) & ~ALIGNMENT)
#define STACK0_SIZE 1000
#define INTERRUPT_STACK_SIZE 5000
u8 InterruptStack[ALIGN( INTERRUPT_STACK_SIZE )];
u8 stack_task0[ALIGN (STACK0_SIZE) ];
int main()
{
return 1;
}
------解决方案--------------------
我试了 结果和你的一样
------解决方案--------------------
cannot allocate an array of constant size 0
因为计算结果为0;而VC不支持0 大小的数组
------解决方案--------------------
u8 InterruptStack[ALIGN( INTERRUPT_STACK_SIZE )];
数组大小为0
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#define MC_PCC_FILL_STRUCT3 u8:0; u8:8; u8:8; u8:8; u8:0;
typedef struct __alg { char c; MC_PCC_FILL_STRUCT3 void * p; } __alg_t;
#define MC_PPC_DISTANCE_OF(S,F) (unsigned) (&(((S *) 0)-> F))
#define ALIGNMENT (MC_PPC_DISTANCE_OF(__alg_t, p) - 1)
#define ALIGN(P) ( (u32) ((char *)(P) + ALIGNMENT) & ~ALIGNMENT)
#define STACK0_SIZE 1000
#define INTERRUPT_STACK_SIZE 5000
u8 InterruptStack[ALIGN( INTERRUPT_STACK_SIZE )];
u8 stack_task0[ALIGN (STACK0_SIZE) ];
int main()
{
return 1;
}
------解决方案--------------------
我试了 结果和你的一样
------解决方案--------------------
cannot allocate an array of constant size 0
因为计算结果为0;而VC不支持0 大小的数组
------解决方案--------------------
u8 InterruptStack[ALIGN( INTERRUPT_STACK_SIZE )];
数组大小为0