Build error with clang-cl since new ogg headers

Since the libogg/libvorbis/opus update on develop (I’m on 44c149abf), juce_audio_formats fails with clang-cl (VS 2026, clang 22, `/std:c++latest`):


juce_OggVorbisAudioFormat.cpp(299,24): error : no template named 'unique_ptr' in namespace 'juce::std'; did you mean '::std::unique_ptr'?

juce_OpusAudioFormat.cpp(70,8): error : no template named 'optional' in namespace 'juce::std'; did you mean '::std::optional'?

Both files open `namespace juce` first and include the C headers inside it:

namespace juce
{
 extern "C"
 {
    #include "ogg/include/ogg/ogg.h"
 }

`ogg.h` and `opusenc.h` include `<stddef.h>`. clang’s `__stddef_nullptr_t.h` declares `std::nullptr_t` on every include when C++20 is enabled (`__has_feature(modules)` bypasses its guard), and the `_MSC_EXTENSIONS` branch is what clang-cl takes. Included inside the namespace, that creates `juce::std`, which shadows `::std` for the rest of the translation unit. MSVC and the other platforms don’t see it, their headers don’t have the declaration.

Fix: include the ogg, opusfile and opusenc headers before `namespace juce`. The `#if JUCE_USE_*` block is closed before the namespace and reopened inside it, the rest of each file stays as it is.

Thank you for reporting this. A fix is now out on develop

3 Likes