SOLVED: compiling error: expected unqualified-id before numeric constant

include keypad.h library only - compiles fine include Ethernet.h library only - compiles fine.

include both libraries - you get the following compile error:

In file included test.ino:36:0: // this is the line before the includes

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: expected unqualified-id before numeric constant
 #define HIGH 0x1
              ^
C:\Users\XX\Documents\Arduino\libraries\Keypad/Keypad.h:63:16: note: in expansion of macro 'HIGH'
 #define CLOSED HIGH
                ^
C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5500.h:88:24: note: in expansion of macro 'CLOSED'
   static const uint8_t CLOSED      = 0x00;
                        ^
Error compiling.

This error was not easy for me to interpret. However, the answer is actually in the 3 messages:

C:\Users\XX\Documents\Arduino\libraries\Keypad/Keypad.h:63:16: note: in expansion of macro 'HIGH'
 #define CLOSED HIGH

CLOSED is defined in the file Keypad.h

C:\Program Files (x86)\Arduino\libraries\Ethernet\src/utility/w5500.h:88:24: note: in expansion of macro 'CLOSED'
   static const uint8_t CLOSED      = 0x00;

CLOSED is ALSO defined in w5500.h

So it is defined twice, with different meanings.

Solution: Rename all occurrences of the variable "CLOSED" in all files of one of the libraries.

The Ethernet library is in the core Arduino IDE. The keypad library is from http://playground.arduino.cc/Code/Keypad, also downloadable from the library manager

I haven't found an explanation of this problem in the forums, so I hope this will be helpful for someone. It seems I'm the first one to use both libraries at the same time!

Thomas

Glad to see you solved it yourself, and thank you for posting the solution!

really helped in my case, just rename:)

tnx!

In my case, including the Ethernet library first and keypad library next solved the problem

#include<Ethernet.h>
#include<Keypad.h>