I'm working on a project that requires all 12 PWM pins to operate 4 RGB LEDs and I want to use the Ethernet shield. The problem is that the Ethernet shield uses pin 10 (PWM) on the Arduino Mega. So I thought I could change the CS pin in the Ethernet library to another pin I don't use and rewire it to the shield later.

@PaulS: Sorry, I should have explained. I include the Ethernet library and that includes the w5100.h file.

Yes, I saw that. The #defines are active, in the ethernet library. But, you didn't include the header file in your sketch, so they are not active there. Compilation units matter. Your sketch is one. The ethernet library is another.

@billRoy:Ah, now we are getting somewhere!It chokes on line 337 just after #define N_WORKED0, the part that starts with #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__).So it is still skipping my added #if defined(__AVR_ATmega1280_DFR__).

The question is why?

Are libraries pre-compiled before the sketch?

And if so is there a way for me make an opt-in alteration that I can enable in the sketch?

@PaulS:So I included the w5100.h and it makes no difference. Is the order bellow correct?