Missing Header in juce_ComponentPeer

Hi!

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


  [ 12%] Building CXX object
  extras/Build/juceaide/CMakeFiles/juceaide.dir/Main.cpp.o

  In file included from
  /home/abique/develop/surge/libs/JUCE/modules/juce_gui_basics/juce_gui_basics.h:271,


                   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:

  
  /home/abique/develop/surge/libs/JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.h:
  In member function ‘void juce::ComponentPeer::setAppStyle(Style)’:

  
  /home/abique/develop/surge/libs/JUCE/modules/juce_gui_basics/windows/juce_ComponentPeer.h:504:18:
  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.

Thanks!

It seems that

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

1 Like