This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I can define a function but can't declare

I defined a function in file.c

#include file.h
unsigned char IsOWKeyRight(const CARD_KEY *Key);
while I had definition
typedef struct{
 unsigned char ID,
 unsigned char ExtID,
 unsigned char pwd
}CARD_KEY;
in an .h file which was included in file.h
Howerer, Keil told me"SYSTEM.H(62): error C141: syntax error near '*', expected ')'" when I declared the function in file.h like the following
extern unsigned char IsOWKeyRight(const CARD_KEY *Key);

what's wrong???!!!
Help!

Parents
  • typedef struct{
     unsigned char ID,
     unsigned char ExtID,
     unsigned char pwd
    }CARD_KEY;
    

    Shouldn't structure fields be separated by semicolons (;) ?

    Assuming it's a typo in the forum post and not in your code, it looks as if the error is actualy caused by the fact that the compiler doesn't know about CARD_KEY when it encounters the function declaration. Are you sure that the header file containing the typedef is included above the function declaration? Sometimes header files can have funny mutual dependencies.

    - mike

Reply
  • typedef struct{
     unsigned char ID,
     unsigned char ExtID,
     unsigned char pwd
    }CARD_KEY;
    

    Shouldn't structure fields be separated by semicolons (;) ?

    Assuming it's a typo in the forum post and not in your code, it looks as if the error is actualy caused by the fact that the compiler doesn't know about CARD_KEY when it encounters the function declaration. Are you sure that the header file containing the typedef is included above the function declaration? Sometimes header files can have funny mutual dependencies.

    - mike

Children