ismail-but-noob's blog

By ismail-but-noob, 13 months ago, In English

Hello, there seems to be a lot of CLion users on macOS who cannot seem to set CLion to use G++ instead of clang++

As we all know G++ is the preferred compiler for competitive programmers as it has a lot to offer (for example bits/stdc++.h, and the Policy Based Data Structures such as ordered_sets)

So, here's a guide to get G++ working on macOS! Firstly, you need to ensure homebrew is installed, you can install it from https://brew.sh After installing it, and adding it to your path, execute the command brew install gcc After executing this and refreshing your terminal. Make sure you now have access to the commands gcc-12 and g++-12 After ensuring they are available, open CLion settings, go to Build, Execution, Deployment -> Toolchains set the build tool to /usr/bin/make, C compiler to whatever the terminal says after executing whereis gcc-12, and C++ compiler to whatever the terminal says after executing whereis g++-12, for example, in my laptop it was these paths: /usr/bin/make , /opt/homebrew/bin/gcc-12 , /opt/homebrew/bin/g++-12

After refreshing CLion, you should be able to be a GCC enjoyer!

I hope that helps someone :D

  • Vote: I like it
  • +38
  • Vote: I do not like it