Damn_N00b_'s blog

By Damn_N00b_, history, 8 months ago, In English

I am using CP Editor on my MacBook M2 pro. I have installed homebrew for GCC. However, I am not able to fix the issue with the bits/stdc++.h header. I have tried so many ways so that I can include it, but failed. I am getting these errors on CP Editor. Can anybody help? Thanks in advance.

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

Just google it

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

    Yes, I have done that already. Unfortunately, none of the solutions worked out.

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

Try to use #include<bits/stdc++.h> line in VS code

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

Can you check if you have bits/ directory or not in compiler starting directory (folder)?

If not then you can checkout the methods mentioned in this blog.

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

try adding #define _GLIBCXX_FILESYSTEM before #include<bits/stdc++.h>

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

This is a GCC-only extension, are you sure you have GCC properly installed and setup?

Macbooks by default fool you by associating g++ with clang.

Run g++ --version on the terminal, if you see "Apple clang version ....", it means you are not actually using GCC.

I haven't been able to make this work on MacOS as it was getting too tedious, advice from seasoned MacOS users here is much appreciated.

  • »
    »
    8 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    A good idea is to download Homebrew, a package manager for MacOS first. Then, it's as simple as brew install gcc in the command line, and setting up cp-editor to use the command g++-13 (or whatever version you want) instead of g++, which is an alias for clang for some reason.

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

I had the same issue with my macbook. mac uses clang compiler which doesn't have bits/stdc++.h header file. you have to install gnu compiler than you have to run this command on the terminal ln -s gcc-11 gcc and ln -s g++-11 g++

you can watch this video if you face any further problem https://www.youtube.com/watch?v=wY24ehH6mC0

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

try sublime! its good for cp