DEV Community

loading...

Discussion on: Running C++17 on Mac M1

Collapse
ayushpattnaik profile image
Ayush Pattnaik Author

Hi, checkout this solution. It worked for me
stackoverflow.com/a/40935471/13556971

Since, bits/stdc++ is a GNU GCC extension, whereas OSX uses the clang compiler.

You have to create bits directory inside /usr/local/include and then make a header file stdc++.h inside bits and paste the contents of this gist(gist.github.com/sachin-kmr/ee03a0d...) inside it. Then, it should compile as expected.

Since, /usr directory is hidden by default on Mac OSX.

  1. Open Finder.
  2. Click Go on menu bar then click Go to folder or Press Command+Shift+G directly.
  3. Enter the path /usr/local/include
  4. Now proceed as mentioned above. (UPDATE: For latest OS X you need to make folder include inside local and make bits folder inside include folder and then copy paste the code inside bits folder.)