diff --git a/include/ctype.h b/include/ctype.h index 6eaf6d50a90..554ece95535 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -35,6 +35,23 @@ #include #include +#ifndef _MSC_VER + +/* GNU libstdc++ is expecting ctype.h to define a few macros for + * locale related functions like C++ streams. + */ + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +#endif + /**************************************************************************** * Inline Functions ****************************************************************************/ diff --git a/libs/libc/ctype/lib_ctype.c b/libs/libc/ctype/lib_ctype.c index 72638694ae4..b97076cc97d 100644 --- a/libs/libc/ctype/lib_ctype.c +++ b/libs/libc/ctype/lib_ctype.c @@ -32,8 +32,10 @@ * Macro Definitions ****************************************************************************/ -/* GNU libstdc++ is expecting ctype.h to define a few macros for - * locale related functions like C++ streams. +#if defined(_MSC_VER) + +/* MSVC seems to conflict with theses macro if defined in the public area. + * As such, they are defined in the private section to let NuttX build */ #define _U 01 @@ -45,6 +47,8 @@ #define _X 0100 #define _B 0200 +#endif + /**************************************************************************** * Private Types ****************************************************************************/