Hướng dẫn add thư viện bits stdc h

Thông báo quan trọng: Cxxdroid yêu cầu bộ nhớ trong trống ít nhất 150MB. 200MB + được khuyến nghị. Nhiều hơn nếu bạn đang sử dụng các thư viện nặng như Boost.

Tham gia vào quá trình phát triển Cxxdroid bằng cách báo cáo lỗi hoặc cung cấp các yêu cầu tính năng cho chúng tôi. Chúng tôi đánh giá cao điều đó. Danh sách các tính năng chưa có sẵn, nhưng chúng tôi đang làm việc để thêm chúng: - Trình gỡ lỗi

Vì mục tiêu chính của Cxxdroid là giúp người dùng học ngôn ngữ lập trình C ++, ưu tiên đầu tiên của chúng tôi là chuyển các thư viện phổ biến, lưu ý rằng khi yêu cầu chúng tôi thêm một số thư viện.

I was trying to figure out how to include bits/stdc++.h on macos since it uses clang, So once i found the solution i thought of creating a clear video about how to do it.

Video Link : here

Hướng dẫn add thư viện bits stdc h
Hướng dẫn add thư viện bits stdc h

4 years ago, |

0

For me this only works in Xcode. It still doesn't compile in CLion or in the terminal.

  • *
    Hướng dẫn add thư viện bits stdc h
    3 years ago, | +3 I think that isn't enough. With that you still are unable to use tree_policy. The best solution is installing gcc with homebrew.

Hướng dẫn add thư viện bits stdc h
Hướng dẫn add thư viện bits stdc h

4 years ago, |

+2

Tbh, it's not worth using bits/stdc++.h. If you type out only the headers you need (with an autocomplete for standard headers maybe), you'll lose some seconds, but on the other hand, you'll save seconds of compilation time because the compiler won't have to go through all the headers on your system and figure out which declarations you need and which ones can be optimised out. When you need to debug and aren't slow at debugging, waiting 2 more seconds for each recompilation can be quite a waste.

  • Hướng dẫn add thư viện bits stdc h
    Hướng dẫn add thư viện bits stdc h
    4 years ago, | -10 I use a precompiled bits/stdc++.h header and my compilation time is around 0.6 seconds
    • Hướng dẫn add thư viện bits stdc h

      4 years ago, | 0 How can i get a precompiled bits/stdc++.h header?

      • Hướng dẫn add thư viện bits stdc h
        Hướng dẫn add thư viện bits stdc h
             4 years ago, |  
             +4  
             Not sure if this will work on Windows but it's worth a try:  
        
        • Find the file stdc++.h which is referenced by the compiler.
        • Compile the file using the same command line options as usual (warnings, optimizations, etc)
               You should get a file called stdc++.pch right next to stdc++.h. Continue using  
                 
               user@home-MacBook-Pro ~ % g++-12 --version  
               g++-12 (Homebrew GCC 12.2.0) 12.2.0  
               Copyright (C) 2022 Free Software Foundation, Inc.  
               This is free software; see the source for copying conditions.  There is NO  
               warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
                 
               0 as usual. Next time you compile a file which includes`bits/stdc++.h` you should see a substantial change in compilation time (2-4 times faster)  
    • ![](https://https://i0.wp.com/userpic.codeforces.org/50468/avatar/69bc1400e66dced8.jpg) 3 years ago, | +10 Why is this down-voted? It's intended way to use bits/stdc++, that's what it was created for.

Hướng dẫn add thư viện bits stdc h

4 years ago, |

0

this video help me to solve the same problem, you can change clang to g++ if you like

Hướng dẫn add thư viện bits stdc h

4 years ago, |

0

First open finder. Then press shift+cmd+G.

Then copy this /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ and paste it in the box. then click Go.

When you're in v1 folder create a new folder called bits after that create a new file called stdc++.h

Then go to this page: https://github.com/tekfyl/bits-stdc-.h-for-mac/blob/master/stdc%2B%2B.h copy the content and paste it in stdc++.h file and save it.

And that's it.

  • Hướng dẫn add thư viện bits stdc h
    3 years ago, | 0 bits/stdc++.h disappears everytime I update Xcode, is there any way to fix this?

Hướng dẫn add thư viện bits stdc h
Hướng dẫn add thư viện bits stdc h

4 years ago, |

0

Well, I find it necessary to install GCC. With GCC there is also pbds, _Find_first, etc... It’s frustrating for me to be unable to use GCC features on my Mac.

  • Hướng dẫn add thư viện bits stdc h
    4 years ago, | Rev. 2 0 the way i mentioned above, allows us to us pbds... and all gcc libreries, you can change clang to gcc on that way or you can alse compile using g++8

Hướng dẫn add thư viện bits stdc h

3 years ago, |

Rev. 4 0

I use mac and the following includes do the trick almost all the time (atleast till problem D)

Hướng dẫn add thư viện bits stdc h

3 years ago, |

0

I was face a same problem with it. after search couple of hour to fix the ‘bits/stdc++.h’ file not found error

Write a simple tutorial how to fix in macOs and windows fix in ‘bits/stdc++.h’ file not found here is the tutorial link. hope this will help

TUTORIAL

If you have more suggestions please tell me I will add

Hướng dẫn add thư viện bits stdc h

23 months ago, |

Rev. 3 0

For those who don't still have a problem including the file on macOS

  1. go to finder
  2. type command+shit+g
  3. paste this /usr/local/include
  4. create a folder named bits
  5. paste bits/stdc++.h inside of it
  6. restart your editor

I hope this helps.

  • Hướng dẫn add thư viện bits stdc h
    19 months ago, | 0 I arrived at this myself and then saw ur comment. I also had to remove these two lines from my stdc++.h file, namely,

    user@home-MacBook-Pro ~ % g++-12 --version g++-12 (Homebrew GCC 12.2.0) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    3 and

    user@home-MacBook-Pro ~ % g++-12 --version g++-12 (Homebrew GCC 12.2.0) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    4 and it worked fine. MacOS -> 11.6

    • Hướng dẫn add thư viện bits stdc h

      15 months ago, | 0 For me, I only need to remove

      user@home-MacBook-Pro ~ % g++-12 --version g++-12 (Homebrew GCC 12.2.0) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

      3. (MacOS 12.4)
  • Hướng dẫn add thư viện bits stdc h
    7 months ago, | 0 it works but still shows red underline under the header in ms VS code.

Hướng dẫn add thư viện bits stdc h

12 months ago, |

0

Even this video didn't helped me out in order to solve the problem, I am still getting the same error. Should I also have to check other things to work this out?

  • Hướng dẫn add thư viện bits stdc h

    12 months ago, | 0 Run g++-12 instead of regular g++. Regular g++ is clang which doesnot have bits/stdc++. g++-12.

    user@home-MacBook-Pro ~ % g++ --version Apple clang version 14.0.0 (clang-1400.0.29.202) Target: x86_64-apple-darwin22.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

    The below one is the g++ compiler you need to use(below one is without clang).

    user@home-MacBook-Pro ~ % g++-12 --version g++-12 (Homebrew GCC 12.2.0) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hướng dẫn add thư viện bits stdc h

12 months ago, |

0

Note, g++-12 automatically has bits/stdc++ so you just need to switch the compiler only. No need to copy extra files.

Hướng dẫn add thư viện bits stdc h

12 months ago, |

0

Hi, Can you please tell me which compiler is faster and best among all. I am also using clang in mac.