Keil Logo


Information in this article applies to:

  • C51 Version 5.50


I have written the following code:

extern struct S foo;

void main(void)

It generates the following error from the compiler:

ERROR 230 IN LINE 6 OF TEST.C: 'S': unknown struct/union/enum tag

The structure is defined in another source file so why is it generating this error?

It doesn't generate the error if I declare a pointer to struct S.


This is a bug in the compiler and the error should only be generated if you try to access the structure (as the type struct S has not been defined in the scope of the source file).

This will be fixed in the next version of the compiler.


As a workaround place the structure declaration of S in a header file and include it in all source files that use that type.

Last Reviewed: Tuesday, June 15, 2004

Did this article provide the answer you needed?
Not Sure
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.