Clang/LLVM compilation on W10 x64

Hi there,

I am trying to compile on VS2019 using Clang/LLVM (W10 x64) but I get three errors:

  1. expected a ‘)’
    ( juce_VST3_Wrapper.cpp, line 3159 )

  2. pragma comment requires parenthesized identifier and optional string
    ( juce_VST3_Wrapper.cpp, line 3159 )

  3. use of undeclared identifier ‘__cpuid’
    ( juce_win32_SystemStats.cpp, line 66)

I have no problems with other compilers, nor with Clang/LLVM when compiling other stuff.

Thanks,
Esteban

Hi @estefield,

Which version/commit of JUCE are you using?

Hi McMartin,

My version is 5.4.5.

Thanks,
Esteban

Clang support on Windows is quite a recent change in JUCE, but it should work with the current develop or juce6 branches.

Thanks Reuk,

Is juce6 a stable branch?

No, we’re still getting it ready for the proper release, but that should be happening quite soon now. I don’t expect there to be large changes between now and the release.

OK. I will wait, then.
In off-JUCE tests of my code, LLVM gives me over 50% improvement in efficiency as compared to other compilers, so this will be great!
Thanks for the prompt response,

AFAICS, several issues with Clang on Windows were fixed in this commit:


which is part of JUCE 5.4.7. So you could consider upgrading.

Thanks!

Hey there, did you manage to make it work? Was it using CMake or by changing the toolchain in Visual Studio ? Can you explain the process? I wanted to set llvm as the compiler in a project generated by the Projucer but didn’t find how to do that in VS :confused:
Thanks!

1 Like

First install the LLVM tools for VS with the VS installer. Then in Configuration properties, General set Platform Toolset to LLVM (clang-cl). In the Librarian / Linker options disable Link Time Code Generation (LLVM doesn’t support it and it makes clang stop). You may need to enable extensions if you use them -I added -mavx -mfma to the compiler command line (in C/C++ options).