bits/stdc++.h does not work in mac os

why does this happen? is there a way to solve this issue.

1 Like

What compiler are you using? Afaik, bits/stdc++.h is a header only found in the GNU C++ Compiler (G++).

I’m probably wrong about the GNU part, but the compiler question is relevant.

bits/stdc++ is a GNU GCC extension, whereas OS X uses the clang compiler. However, you can still make it work by manually creating the header file.

Inside the directory /usr/local/include/bits (create bits), make a file called stdc++.h and paste the contents of this gist. Now it should compile as expected.


Follow this link… It will help… :slight_smile:

Mac OS X 10.9+ no longer uses GCC/libstdc++ but uses libc++ and Clang. After the XCode 6.0.1 update the headers are now located here:


To open this address follow these steps:

  1. Open Finder.
  2. Click Go on menu bar then click Go to folder or Press Command+Shift+G directly.
  3. Enter the path /Applications/

Now, get the stdc++.h file from here,then creat bits directory in the above long address, and copy the file stdc++.h to the bits directory.