I have not done anything fancy yet in this Visual Studio environment just getting started and only copied the “Get started” code from GLFW and rendered a window with basic primitive shape. But I have noticed when I switch the compiler toolset from MSVC to LLVM/Clang the compiler start giving 3 errors, two of then are “identical”, not quite sure, with the error code E0020
twice and the description of them is identifier "__bf16" is undefined
and that is coming from a file that exists in the llvm toolset dir under the name "emminitrin.h"
lines 47
and 48
.
The third error code is E0059
and its description is function call is not allowed in a constant expression
and that is coming from a file named xmminitrin.h
that is also exists inside the llvm toolset dir from VS and more precisely C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\lib\clang\16\include\emmintrin.h
if that helps in anyway.
As mentioned in the title this small environment works fine “I think” but I am kind of hopeless at this point as I have scavenged almost the entire web to find at least a hint for the problem but nothing is there.
When looking up the lines of code where errors are coming from, they are as following:
Line 47
in file emminitrin.h
:
typedef __bf16 __v8bf __attribute__((__vector_size__(16), __aligned__(16)));
And
Line 48
in the same file:
typedef __bf16 __m128bh __attribute__((__vector_size__(16), __aligned__(16)));
And
Line 3013
in file xmminitrin.h
#if defined(__SSE2__) && !__building_module(_Builtin_intrinsics)
and it litteraly says above it in a comment
/* Ugly hack for backwards-compatibility (compatible with gcc) */
One last note that I feel I am obligated to mention is that the moment I open these two files for example VS starts to get another 15 errors and they also regarding identifiers not being defined.
Edit:
Upon further investigation, I have found that what is happening is not actually the compiler fault but rather the VS intelliSense’s. While the LLVM compiler is not the actual causer here but it fires VS’s intelliSense off to then complain about such errors.
Now that I know the errors are only intelliSense errors and the fact that the files are getting compiled and running successfully, I either turn an eye on the errors or just disable the intelliSense process in its entirety. which I don’t think that would be the ideal solution here but hopefully someone knowledgeable can help out and suggest a prober fix.
Until then I will try to keep the question updated and file a solution if I have found one myself.