Is it possible to use g++ as the compiler?

I’m using clangd on macOS; my compile_commands.json looks like this:

  "directory": "xxx",
  "arguments": [
  "file": "xxx.cpp"

But clangd still uses clang as the default compiler…

But clangd still uses clang as the default compiler

Can you elaborate on exactly what you mean by this? Clangd does not involve any external compiler.

clangd uses clang’s parser library to understand the code, generate diagnostics instead. It’s not possible to avoid this, it’s at the core of clangd’s design.

I didn’t know how clangd worked… Sorry for the dumb question.
Here’s what bothers me. I do competitive programming and I work with gcc on single files. When I use the header stdc++.h from gcc (<bits/stdc++.h> in C++ - GeeksforGeeks), the error below pops up:

In included file: definition of builtin function '_mm_getcsr' /usr/local/Cellar/gcc/10.2.0_4/lib/gcc/10/gcc/x86_64-apple-darwin19/10.2.0/include/xmmintrin.h:821:1: note    : error occurred here [builtin_definition]

So _mm_getcsr seems to be a gcc-specific function which clang doesn’t include (
Is there someway to solve this?

Everything works fine when I switch to ubuntu with similar configuration. Does it have something to do with macs?