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

Enum isn't recognized in prototype

Hi, I'm about to pull my hair out.

I have a enumerated type in a file called iap_tools.h that looks like this:

enum ChipType
{
  master_chip,
  slave_chip,
  comm_chip
};

I have a function declared in master.c that looks like this:

void start_firmware_copy( enum ChipType chip_type ){}

I have its prototype in a file called master.h, and it looks like this:

void start_firmware_copy( enum ChipType chip_type );

In master.h and master.c, I've #include "iap_tools.h", so everyone should know about the enumerated ChipType. But when I compile, I get this error:

*** ERROR C230 IN LINE 173 OF MASTER.H: 'ChipType': unknown struct/union/enum tag

So just for fun, I copy the ChipType definition into master.h, but it complains that master_chip (etc) was redefined and that ChipType was a duplicate struct/union/enum tag! It knows darn well what ChipType is! Why is it giving me an error? I use other enumerated types exactly (as far as I can tell) the way I've used ChipType, and they work just fine.

If I change the enumerated type to an unsigned char, everything compiles fine.

So does anyone have a clue what's going on here?

Thanks,
-JB