Can't compile with gcc in zsh shell

Dear Experts

I’m a newbie for ROOT, using MacOS zsh and gcc 11. When I try to compile my code using

g++ `root-config --cflags --libs` -lMinuit -o proton proton.cxx

I got the error

g++-11: error: unrecognized command-line option '-stdlib=libc++'

but it doesn’t appear when I use bash, could someone tell me why zsh doesn’t work? I already set the environment in .zshrc:

### root ###
source /opt/homebrew/Cellar/root/6.26.02/bin/thisroot.sh
alias r++='g++ `root-config --cflags --libs` -lMinuit'

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.26.02
Platform: MacOS
Compiler: gcc11


I am not sure why it depends on the shell you are using.
May be @axel has an idea.

In both shells, run (and compare the outputs): root-config --cxx --cflags --libs

bash:

clang++ -stdlib=libc++ -pthread -std=c++17 -m64 -I/opt/homebrew/Cellar/root/6.26.02/include/root -L/opt/homebrew/Cellar/root/6.26.02/lib/root -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/opt/homebrew/Cellar/root/6.26.02/lib/root -stdlib=libc++ -lpthread -lm -ldl

zsh:

clang++ -stdlib=libc++ -pthread -std=c++17 -m64 -I/opt/homebrew/Cellar/root/6.26.02/include/root -L/opt/homebrew/Cellar/root/6.26.02/lib/root -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -Wl,-rpath,/opt/homebrew/Cellar/root/6.26.02/lib/root -stdlib=libc++ -lpthread -lm -ldl

They are the same…

So, try with:

alias r++='`root-config --cxx --cflags --libs` -lMinuit'

It works! Does this mean that gcc doesn’t work fine with zsh where clang works fine?