We have a bunch of enum values in our code. We need a string in the string table for each one.

MyFile.h
Code:
enum FOO
{
    FOO_BASE = 0,
    FOO_1,
    FOO_2,

    FOO_MAX
};
resource.h
Code:
#define IDS_BAR_BASE  4096
#define IDS_BAR_1     4097
#define IDS_BAR_2     4098
#define IDS_BAR_MAX   4099
I am trying to create a sanity check in case more FOO's or BAR's are added.

MyFile.cpp
Code:
#if ((FOO_MAX - FOO_BASE) != (BAR_MAX - IDS_BAR_BASE))
    #error Each FOO in Myfile.h must have its corresponding BAR string in resource.h. 
#endif
This does not work. The #if evaluates TRUE, the #error is compiled, and I get an error.

A little experimentation shows that the preprocessor is evaluating FOO_MAX as 0.

I have tried a few variations on this, such as ((int)FOO_MAX). Nothing works.

What is wrong? How do I fix it?