Compilation error: expected unqualified-id before '(' token in wiring_constants.h

Hello all,
I'm trying to compile a code for RTL8720DN-BW16 board. But IDE always give me this error:
C:\Users*\AppData\Local\Arduino15\packages\realtek\hardware\AmebaD\3.1.8\cores\ambd/wiring_constants.h:78:19: error: expected unqualified-id before '(' token**
** #define max(a, b) ((a) > (b) ? (a) : (b))**
** ^**
exit status 1

I found this code in the file "wiring_constants.h"

#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif    // min
#ifndef max
#define max(a, b) ((a) > (b) ? (a) : (b))
#endif    // max

Line 78, column 19 is the 2nd "define", ((a)>b)
This library is downloaded from Board Manager, not my code. So what does the error mean and how to fix it?

It most likely means there is an error in the sketch you did not supply.

Posting a snippit from a library is never the answer.

Post your code that #includes this library or some other library that includes this library and then folks can help

1 Like

Show us a complete sketch that demonstrates the error occurring.

It's possible that the sketch you didn't show defines a function named max.

It's possible (but less so) that there's a problem in the 3rd party core.

Want better answers? Show us that complete sketch that demonstrates the error.

To be clear,
Oftentimes the compiler will be confused by some error in your code, but erroneously point to something in included code. The reasons are complicated, but the best you can do is show us your code in order to rule that out...or not.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.