Thanks. In fact, what happened is that I had Homebrew gcc/g++ installed while on Mojave, and later upgraded directly to Monterey. gcc/g++ appeared installed, but a lot of headers were missing when compiling. So I did
% brew reinstall gcc,
and with a couple of symbolic links on /usr/local/bin:
…
Setting board to : sitl
Using toolchain : native
Checking for ‘g++’ (C++ compiler) : /usr/local/bin/g++
Checking for ‘gcc’ (C compiler) : /usr/local/bin/gcc
Checking for c flags ‘-MMD’ : yes
Checking for cxx flags ‘-MMD’ : yes
CXX Compiler : g++ 11.2.0
…
There are much fewer warnings on the build now, and it seems to work very well. Thanks a lot.
So for MacOS Monterey (probably also Catalina and Big Sur):
- If with Apple provided software (XCode), use -D by now as a workaround.
- Better install/reinstall Homebrew gcc/g++, as you say.