MSVC and Clang-CL both report errors in the standard Visual C++ headers. This must be a configuration error, as the standard headers are valid by default. Errors shown (Non declared identifier, redifinition):
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_new.h(47,26): error: unknown type name '_Post_writable_byte_size_'
_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_new.h(47,58): error: expected ';' after top level declarator
_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_new.h(52,54): error: unknown type name '_Post_writable_byte_size_'
_NODISCARD _Ret_maybenull_ _Success_(return != NULL) _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_new.h(52,86): error: expected ';' after top level declarator
_NODISCARD _Ret_maybenull_ _Success_(return != NULL) _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vcruntime_new.h(58,26): error: unknown type name '_Post_writable_byte_size_'
_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
any many, many more...
The source of the errors are these SAL annotations:
_NODISCARD _Ret_maybenull_ _Success_(return != NULL) _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
void* __CRTDECL operator new(
size_t _Size,
::std::nothrow_t const&
) noexcept;
_NODISCARD _Ret_notnull_ _Post_writable_byte_size_(_Size) _VCRT_ALLOCATOR
void* __CRTDECL operator new[](
size_t _Size
);
In file C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\corecrt_malloc.h any many more standard files.
My CMake Toolchain:
I've already tried reinstalling Visual Studio and all the compilers and SDKs, but nothing worked. I've also searched for macros causing this but found nothing. The program compiled file on Linux and MacOS and it compiled on my old Windows 10 too. I've installed Windows 11 and installed the same Toolchains and now it does not work.
