This is because both inclusions occur in the same compilation unit. You can get around this problem by moving the inclusion of one of the enumerations into a separate compilation unit, due to the cost of the values โโof the constants that are not the compiler for the enumerator (in fact, they become global variables).
In pp_workaround.h:
extern const int PAYPAL_ENV_LIVE;
In pp_workaround.m:
#import "PayPal.h"
Now you can include "pp_workaround.h" instead of "PayPal.h" and use PAYPAL_ENV_LIVE instead of ENV_LIVE . Not everything will work the same, but the compile-time error should disappear.
EDIT . If your code allows you to import conflicting headers only in your .m file, you can fix the problem (and not bypass it) by wrapping the connection code in an additional abstraction layer, like this:
In paypal_init.h:
extern void connect_paypal();
In paypal_init.m:
#import "PayPal.h" #import "paypal_init.h" void connect_paypal() {
in the authnet_init.h file:
extern void connect_authnet();
in the authnet_init.m file:
#import "AuthNet.h" #import "authnet_init.h" void connect_authnet() {
In your main file:
#import "authnet_init.h" #import "paypal_init.h" void init() { connect_paypal(); connect_authnet(); }
source share