On macOS, you should have Clang installed by default, which is designed to be a drop-in replacement for the normal compilers for C, C++, and other similar languages. Check whether the version is 3.3 or later using clang --version in a Terminal. If you do not have Clang or something from the older versions, then you can install using the xcode command-line tools using a Terminal:
$ xcode-select --install
A dialog should appear next that asks if you want to install the developer tools. Click on the Install button.