Well after seeing countless videos, let me summarize it for you !!!
There are two types of compiler variant available for MAC.
- Provided by xcode-developer support called
clang - Another one is provided by GCC/GNU , can be downloaded by command
brew install gcc
To check which version you are using
- Run
g++, if it showsclangthen , you are using xcode variant - if it shows some a string like
g++-13in the compilation then you are using the GCC/GNU one
If you want to use both of them, you can easily choose between them :-
g++-14 <filename>: for GNU/GCCg++ <filename>: for the clang
If you want to work with bits/stdc++.h , you must use GNU/GCC based compiler.
- If you’re using
vscodedo check, at which compiler locations yourg++settings points.
I just add an alias in my .zshrc file
alias g++="g++-14"
alias gcc="gcc-14"But if you do want to execute your code using clang++ then you can use following command ?
clang++ -std=c++17 mul_table.cppWhy was all this necessary ?
- Because of the fact that
clangdoesn’t support#include<bits/stdc++.h>- Which was annoying for me…
- Hope this helps !!