Missing Header in juce_ComponentPeer


A colleague was trying to build surge with g++12 on arch linux. He got the following error

  [ 12%] Building CXX object

  In file included from

                   from /home/abique/develop/surge/libs/JUCE/extras/Build/juce_build_tools/juce_build_tools.h:56,
                   from /home/abique/develop/surge/libs/JUCE/extras/Build/juceaide/Main.cpp:26:

  In member function ‘void juce::ComponentPeer::setAppStyle(Style)’:

  error: ‘exchange’ is not a member of ‘std’

    504 |         if (std::exchange (style, s) != style)
        |                  ^~~~~~~~

  make[2]: *** [extras/Build/juceaide/CMakeFiles/juceaide.dir/build.make:76:
  extras/Build/juceaide/CMakeFiles/juceaide.dir/Main.cpp.o] Error 1

  make[1]: *** [CMakeFiles/Makefile2:131:
  extras/Build/juceaide/CMakeFiles/juceaide.dir/all] Error 2

  make: *** [Makefile:136: all] Error 2

and from looking, it certainly does look like juce_ComponentPeer.h inlines std::exchange and doesn’t #include <utility>

We are at juce 6.1.6 but I notice the header is also missing on juce7 branch.


It seems that

is only on develop. I guess it needs to be cherry-picked to master and juce7.

1 Like