Compiler warning after simply #including <switch.h>
jpjokela opened this issue · comments
Using my own Makefile with some required modifications for switch, and here's the problem:
including <switch.h> includes "switch/services/audren.h", which has line
"#if __cplusplus >= 201402L". __cplusplus is completely undefined in my C code.
That becomes a warning (which becomes build breaking error, with any sensible build switches)
Perhaps there should be #ifdef __cplusplus around it?
This is not an issue at all in any of the C-only projects that are built with libnx. Can you post your makefile? If it's a Switch-exclusive project, you should use the project template we provide instead of trying to come up with your own makefile.
Addendum: C standard says that undefined identifiers in #if
expressions evaluate to zero. So the #if-section in audren.h is legal and well formed.
In the end, this is caused by -Wundef warning flag (and -Werror obviously)
As a workaround, adding -Wno-error=undef to the switch specific compile flags works.