This is a linker error.
ld is the linker on macOS. The compiler takes source files (
.mm files in JUCE) and produces object files (
.o files on macOS). The linker combines the object files to produce an executable or a library.
In your example, the linker complains that
juce::componentPeerAboutToChange(), but no other
.o file is defining it.
juce::componentPeerAboutToChange() is defined in
juce_gui_basics only needs that function when
JUCE_MODULE_AVAILABLE_juce_opengl is defined and non-zero (usually set to 1).
It seems that
JUCE_MODULE_AVAILABLE_juce_opengl is defined (I guess in the
AppConfig.h header generated by Projucer), but
include_juce_opengl.mm is not compiled when building your project.