AlgoDragon_'s blog

By AlgoDragon_, history, 17 months ago, In English
  1. Install the Xcode app from App Store
  2. Go to the path = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 To do this easily, open Finder and press Cmd+Shift+G and paste this path address and it should open up.
  3. Create a folder named bitsand go to this folder.
  4. Create a file named stdc++.h inside the bits folder and open it using any text editor (e.g. TextEdit)
  5. Paste the content from this repo to stdc++.h file: stdc++.h
  6. Now close Sublime Text/VS Codeand reopen it and run a C++ file.
  7. It should work!

    If it doesn’t work:

  8. Try the same thing using path = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/
  9. It should work now, but it might give you errors like include is not found or similar. Just remove this include from the stdc++.h -------- file and try again.
  10. You might need to remove multiple includes and it should work eventually(at least it worked for me!). In my case, I had to remove the following lines from stdc++.h:
  • #include<cstdalign>
  • #include<cuchar>
  • #include<memory_resources>

If it still doesn’t work, try with path = /usr/local/include

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

| Write comment?
»
7 weeks ago, # |
Rev. 2   Vote: I like it +3 Vote: I do not like it

for macos version 14.2 user

/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/ ****

use this path instead

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    the new one doesn't work I use Sonoma 14.3.1 and Xcode 15.2 and the /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ is the only work

»
3 weeks ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it
  • Inside the directory /Library/Developer/CommandLineTools/usr/include/c++/v1
  • Create a directory named bits
  • Create stdc++.h file
  • link for stdc++.h file

Now open Xcode and click on your project name and navigate to Build Settings and look for Search Paths. Double-click on Header Search Paths from that section, hit the '+' button, and paste the directory path and boom it should work now.