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

C51 header file problem

Hi,
I've been looking at this compile error for a few hours now so I decided to look for some community support.

I created a header file "SCMCtl.h" which contains a Struct declaration and a function prototype.
Here is the declaration:

//SCMCtl.h
struct SCM_status
{
unsigned char mode;
unsigned char battery;
unsigned char door;
unsigned char light;
};

struct Cassete_status
{
unsigned char mode;
unsigned char battery;
};

struct Status
{
unsigned int    number_of_cassettes;
unsigned int    status_read_ok;
struct SCM_status SCM;
struct Cassete_status Cassette1;
struct Cassete_status Cassette2;
struct Cassete_status Cassette3;
struct Cassete_status Cassette4;
};

struct Status SCM_PO(void);

In my main module, where I create two instances of struct Status and make a call to SCM_PO();, I include the header file. However I get:

*** ERROR C230 IN LINE 47 OF main.c: 'Status': unknown struct/union/enum tag
*** ERROR C230 IN LINE 48 OF main.c: 'Status': unknown struct/union/enum tag
*** ERROR C202 IN LINE 64 OF main.c: 'statusRE': undefined identifier
*** ERROR C202 IN LINE 73 OF main.c: 'statusGR': undefined identifier

However if I declare the structs and type the func proto directly in the file, I am able to compile with no problems whatsoever.

This seems very strange to me since I have always thought of the include process as copy/paste almost.
I can´t understand why one way works and the other doesn´t.

Thanks for the input!

Pablo

0