Muhammad_Nadim's blog

By Muhammad_Nadim, 6 months ago, In English

I'm on macOS Sonoma 14.5 and I updated Xcode to version 14.4; the steps that worked for me are:

  1. Open Finder.

  2. Goto the below directory /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/; You can also click command+shift+G, copy-paste the above directory, press return and this should take you to the directory.

  3. Create a new folder in the directory. Rename it with bits.

  4. Now, open Xcode, click on File in the above menubar, select >new >file, click on macOS, select header file and create one named stdc++ and place it in your desired folder.

  5. Click here; this includes all the necessary header files, copy-paste all the contents to the stdc++ header file and save it.

  6. Now, copy the header file and goto the directory in step 2, open bits folder and paste the header file there.

  7. Exit any running IDE (i.e. VS Code).

That's it! You're all set. Now, open your desired IDE and Voilà! You can now include bits/stdc++.h in your c++ file. Hope this helped. :-)

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

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Wow it works thanks bro

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It is really helpful thx! I was able to include bits/stdc++ before but after a system update or something it did not work anymore. Took me quite long but could not fix it now it works again

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Another alternate is to install gcc compiler. Now you can either use g++-14 to compile your code or simply create a symlink by running the commands:

  1. cd /opt/homebrew/bin
  2. ln -s g++-14 g++

This will also allow you to use policy based data structure (if you aren't able to)

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone please link to blog to installing gcc on Xcode? Thanks!!

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Alternative solution: Don't use Mac

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why?

    Mac laptops are often faster, have longer battery life, better build quality, better speakers, better design, and better customer service than any other type of laptop.

    I think you can make an argument though if you're talking about only operating system.

    • »
      »
      »
      6 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I'm just kidding. But in all seriousness you can get a better laptop with the same price. This is true about every apple product.

      Now i do agree with the customer service, but other than that, there is nothing else.

      Note that these are just my opinions, and i don't really mean to hate on anyone.