I’m trying to figure out which CPP standard the compiler is using, when I compile on Windows this works, but when I compile on Linux nothing gets set and the vale remains 0. Am I doing something wrong?
#define CPP_STANDARD 0L
#ifdef _WIN32 // WIN32 START
#if _MSVC_LANG == 202002L
#define CPP_STANDARD 2020
#elif _MSVC_LANG == 201703L
#define CPP_STANDARD 2017
#elif _MSVC_LANG == 201402L
#define CPP_STANDARD 2014
#endif // WIN32 ENDIF
#else // NOT WIN32 START
#if __cplusplus == 202002L
#define CPP_STANDARD 2020
#elif __cplusplus == 201703L
#define CPP_STANDARD 2017
#elif __cplusplus == 201402L
#define CPP_STANDARD 2014
#elif __cplusplus == 201103L
#define CPP_STANDARD 2011
#endif
#endif // NOT WIN32 ENDIF
#if CPP_STANDARD == 0L
#error "No CPP Standard detected"
#endif