I just installed Elementary OS to program mainly because of its editor simplicity. However I don't know how to transform it into an IDE for C++.
You can try this: https://quickfever.com/how-to-setup-c-plus-plus-development-environment-in-linux/. Elementary OS is a derivative of Ubuntu so you may have success with this method.
I think you need to compile via CLI (Terminal), or use an IDE that's integrated with C++. https://stackoverflow.com/questions/24109/c-ide-for-linux
In the Code app's settings, enable the terminal view. After that, you can freely use can compile your C++ code in the terminal using the CLI. The
gcc command for the GCC compiler should be available for you to use, out of the box.