Thread: E1116 and E1009 errors, how to fix?

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    4

    E1116 and E1009 errors, how to fix?

    Hi everyone,

    to get straight to the point, i'm getting the following errors:

    Error! E1009: Expecting ',' but found '*'
    Error! E1116: An id list not allowed except for function definition

    and it refers to the following file and code:
    file:
    sja1000.h,
    code:
    Code:
    extern sja1000_result_t sja1000_xmit(HwCanMsgTxType* CAN_TxQueue, TxQueueCtrlType* CAN_TxQueueCtrl);
    the prototype function wrong, but i have no idea what the problem could be.

    the function is writting in sja1000.c
    Code:
    sja1000_result_t sja1000_xmit(HwCanMsgTxType* CAN_TxQueue, TxQueueCtrlType* CAN_TxQueueCtrl)
    {
    }
    and i call the function a few times from pcancommon.c with different parameters:
    Code:
    sja1000_result = sja1000_xmit(&CAN11_TxQueue, &CAN11_TxQueueCtrl);
    sja1000_result = sja1000_xmit(&CAN12_TxQueue, &CAN12_TxQueueCtrl);
    sja1000_result = sja1000_xmit(&CAN21_TxQueue, &CAN21_TxQueueCtrl);
    sja1000_result = sja1000_xmit(&CAN22_TxQueue, &CAN22_TxQueueCtrl);
    'HwCanMsgTxType' and 'TxQueueCtrlType' are structs.

    I don't know if this is enough information to clear things up. the code is compiled using the watcom compiler. the codes are used in Matlab.

    Thanks for your help!

    Robbin

  2. #2
    Registered User
    Join Date
    Jan 2010
    Posts
    34
    Few informations for answering.

    Are you sure that the struct's are defined before the extern definition?

  3. #3
    Registered User
    Join Date
    Aug 2010
    Posts
    4
    Hi,

    The structs are defined in the pcancommon.c file and when i look in the result the compiler gives me, it''s not yet compiled.
    I'm not sure how Matlab deals with this.

    first the function of sja1000_xmit looked like this:
    Code:
    //sja1000_result_t sja1000_xmit(sja1000_canchip_t* sja1000_canchip_p)
    but i changed the function cause i needed more functionality. the code within sja1000_xmit used the CAN_TxQueue and CAN_TxQueueCtrl back then as well, but now i'm trying to make it look beter by passing it through using the function.

    it could be that i did something wrong with the pointers. first time i'm working really with pointers.

    thanks for your reply!

    Robbin

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    34
    But the struct's must be defined somewhere in sja1000.h before the exetrn declaration.
    The compiler must know in advance what CAN_..... are!
    If you define only in .C file, the compiler fails.
    Try to remove it from the .C and move in the .h

  5. #5
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    I think defining struct in .c file means it's to be hidden.
    So you just put 'struct forward declaration' in .h file.

    sja1000.h,
    Code:
    typedef struct blablah HwCanMsgTxType;    
    typedef strut   foo_bar   TxQueueCtrlType;
    
    extern sja1000_result_t sja1000_xmit(HwCanMsgTxType* CAN_TxQueue, TxQueueCtrlType* CAN_TxQueueCtrl);

  6. #6
    Registered User
    Join Date
    Aug 2010
    Posts
    4
    woops my bad, i meant pcancommon.h. after including a header file the problem was solved.

    unlucky i got others in return like:
    Error! E1022: Missing or misspelled data type near 'sja1000_canchip_t'
    Error! E1022: Missing or misspelled data type near 'sja1000_canchip_t'

    i have a struct in sja1000.h:
    Code:
    typedef struct
    {
      u32 dwPort;				
      u32  dwConfigPort;             	
      volatile u8* pvVirtPort;       	
      volatile u8* pvVirtConfigPort;	  
    u16 wIrq;	                   
    unsigned int nChannel; 	       
      unsigned int nBoard;
    } sja1000_canchip_t;
    in pcancommon.h i use the struct mentioned above:
    Code:
    typedef struct
    {
    sja1000_canchip_t* sja1000_canchip; //error on this line
    }pcan_candev_t;
    same error in this struct:
    Code:
    typedef struct
    {
        u32 Id;       
        u8  Dlc;      
        u8  Data[8u]; 
        u8 Board;		
        sja1000_canchip_t* sja1000_canchip_buf; //error on this line
    } HwCanMsgTxType;
    What could be the problem?

    thanks

    Robbin van den Berg

  7. #7
    Registered User
    Join Date
    Jan 2010
    Posts
    34
    is sja1000.h included in or before pcancommon.h?

Popular pages Recent additions subscribe to a feed

Tags for this Thread