There are many things that I find missing in default C++ build in Mac Sublime Text(clang) like no bits/stdc++.h header, regular warnings on using auto keyword, using inline comparator functions etc. So I tried searching how to use brew's g++ as default build in Sublime Text without breaking anything but couldn't find anything.
C11 features usage. Here you will need a custom build system for Sublime text. It's easy to create! 3 easy steps again. 1) Download gpp.sublime-build from my GitHub. 2) Go to Sublime, then select Tools-Build System-New Build System. This is the place where you should paste gpp.sublime-build. Don't forget to save the file. I am learning C at college now, and teachers told me to use codeblocks as an IDE, but in my opinion codeblocks is a bit ugly and that's why I've chosen Sublime Text 2, the BEST IDE/Text Editor out there. At the moment I write my code via sublime, save it and then compile it via mac os terminal (gcc) and than run it on the terminal as well.
First of all install brew from brew.sh.
After that install gcc using the command in terminal 'brew install gcc'.
Check if install is complete using command 'gcc-11 --version' (I got gcc-11 installed, in future you may use gcc-12,gcc-13 etc).
Typescript Sublime Plugin
Now type the command 'which g++-11' to get the location where g++-11 got installed. Copy this location ( Mine was something like — /opt/homebrew/bin/g++-11 ).
Sublime Text C++ Plugin
Open sublime text and install 'PackageResourceViewer' from Package Control. After that open command palette and open 'PackageResourceViewer: Open resource'. Neo geo roms for android.
Then go to C++.
Sublime Text C++ Compiler Machine
Then go to C++ Single file.
Finally replace all g++ with the location we copied earlier (/opt/homebrew/bin/g++-11).
Save this file using cmd+s and restart sublime text. Compile and build as you would usually do in sublime text (cmd+b/cmd+shift+b) and this time it would build using brew's g++.
If you would like to revert back to original g++, just go back to C++ Single file build and change '/opt/homebrew/bin/g++-11' to 'g++' wherever applicable.
Thanks