AnsweredAssumed Answered

9S12XEP100 compiler issue: extern a structure

Question asked by Peter Yu on Jul 26, 2016
Latest reply on Jul 27, 2016 by Alice_Yang

Hi,

 

In my CAN application project including 3 files: main.c, CAN_drv.c, and CAN0_app.c.

CAN_drv will contain some CAN driver functions and structures about CAN message.

CAN_app contains some application functions in my system.

main.c will use these application functions in CAN_app.c.

 

CAN_drv.h

typedef struct  {   UINT   id;   BOOL   RTR;    UBYTE  data[8];     UBYTE  prty; } tCAN_MSG; extern tCAN_MSG canRxMsg[5], 

CAN_drv.c

#include "CAN_drv.h" tCAN_MSG canRxMsg[5];

CAN0_app.c

#include "CAN_app.h" void CAN0_RX(tCAN_MSG *msg) { ... }

CAN0_app.h

#include "CAN_drv.h" extern void CAN0_RX(tCAN_MSG *msg);

main.c

#include "CAN_drv.h" #include "CAN_app.h" void main(void){      CAN0_RX(msg); }

 

My CodeWarrior version IDE is 5.9.0 and compile error list occured in CAN0_app.h

"extern void CAN0_RX(tCAN_MSG *msg);"

The error list is below:

C5002: Illegal type,

C1815: msg not declared (or typename),

C1834: Indirection applied to non-pointer,

and other strange error about missing ";" or "}"

 

Is there some declaration i missed?

Or this application structure should be modified to another type?

Outcomes