+2  A: 

Because main.h #includes other.h, it doesn't need to #define MAX_GROUPS again. It'll pick up that definition from the inclusion.

jwismar
+3  A: 

Minimising circular dependencies is very important in maintaining your project. For an extended discussion, see "Large Scale C++ Software Design" by John Lakos.

To avoid the specific problem you are having, define values in one header file, and include that header file in every file that needs it. To avoid problems with multiple definitions, use include guards:

#ifndef HEADER_THING_H
#define HEADER_THING_H

/* Rest of the header file goes here. */

#endif

That way if it is already included, it is harmless.

janm
A: 

Generally, you should put the defines inside whichever header is relevant -- or where it is primarily used. In this case, you should put MAX_GROUPS inside other.h. By including other.h in main.h, the define will also be picked up (as mentioned by jwismar).

For bigger projects, however, you'd be better off creating a header file containing only your manifest constants (defines) and just include that where needed.

vij
A: 

You could also protect your constants against redefinition case by case...

#ifndef MAX_GROUPS
#define MAX_GROUPS 100
#endif
Brian Hooper