Harbol
Harbol copied to clipboard
Compile Errors with MSVC - Erroneous Macros
Architecture: Tested on both x86 & x64 OS: Windows IDE: Visual Studio 2022 C++ Standard: 14
A number of compile errors are thrown when attempting to compile a C++ source file that includes both harbol_common_defines.h and a standard STL header.
I have located the erroneous macros:
https://github.com/assyrianic/Harbol/blob/883313f8544ef7b49bb70121e20c80a6e260e34f/harbol_common_defines.h#L329 https://github.com/assyrianic/Harbol/blob/883313f8544ef7b49bb70121e20c80a6e260e34f/harbol_common_defines.h#L341
The interfering _CRTRESTRICT macro of corecrt.h:
#define _CRTRESTRICT __declspec(restrict)
By defining _CRT_SUPPRESS_RESTRICT the macro will be excluded from the build, a possible solution. However, I am unsure if it would break compatibility with other libraries.
In regards to inlining, the C++ standard library forbids macroizing the keyword "inline," according to xkeycheck.h:
#if defined(inline) #define inline EMIT WARNING C4005 #error The C++ Standard Library forbids macroizing the keyword "inline". \ Enable warning C4005 to find the forbidden define. #endif // inline