Блог пользователя sailikpandey

Автор sailikpandey, история, 2 года назад, По-английски

Hi Codeforces,

Today I am gonna tell you the complete solution on how to use gcc compiler instead of using apple CLANG for those who are using MAC.

  1. Go to brew official website and copy the code below "Install Homebrew", it will be like /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  2. Open Terminal from the launchpad and paste it in your terminal and press enter to run it.

  3. Now it will ask for the sudo password and then enter your mac password and then run it. Next it will ask press RETURN to continue and hit return. After then it will take take some time to download and install it on your mac.

  4. After some time, it will show: View this image. Then copy the first code and then run it and then copy the second code and then run it. If it doesn't run reopen the terminal and then run it. It will show something like this.

  5. Now reopen the terminal and type brew and press enter. It should show the list of all the brew commands

  6. Congratulations now you have successfully installed brew on your mac.

  7. Now its time to install GCC compiler in your MAC.

  8. Open terminal and type brew install gcc

  9. Now type g++-12 --version and it will show the current version of the gcc compiler installed.

  10. Now type g++ --version it will show apple clang instead of gcc. Something like this.

  11. That means the current default compiler is clang not gcc. So we have to set it to GCC compiler as the default compiler.

  12. Now type cd /opt/homebrew/bin, press enter and then type ln -s g++-12 g++ and press enter.

  13. Now again type g++ --version and it will show something like this. That means you have successfully installed gcc in your MAC and has been set as the default compiler.

Now whenever you compile a code in VS CODE, sublime etc. it will compile default with the GCC compiler instead Apple Clang.

I will be pleased if this blog is helpful to anyone. Please share this blog so if anybody is trying to install gcc can see this solution. Thank you. Have a nice day:)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -39
  • Проголосовать: не нравится