g++ version not updated after command line tools installation

Hello,

I want use PyMC3 on my computer. I need g++ for that, which is installed via command line tools. I have command line tools installed together with xcode, but when I run my code, g++ headers are not found and I'm prompted to install g++ with command line tools. I redo the installation and when I re-run my code, I get the same message. Also when I do g++ --version I get the following message:

ebuild: error: SDK "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk@" cannot be located. g++: error: Failed to determine realpath of '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk@' (errno=No such file or directory) g++: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk@ -find g++ 2> /dev/null' failed with exit code 16384: (null) (errno=No such file or directory) xcode-select: Failed to locate 'g++', requesting installation of command line developer tools.

Another thing is that, the version of SKD in my directory is, /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk@.

But g++ is looking for MacOSX11.3.sdk@.

How can I fix this problem? I currently have OS monterey 12.0.1.