fatal error: 'bits/stdc++.h' file not found mac os


I am getting this error when trying to run a C++ program on mac opertaing system.
My program contains



asked 2 years, 3 months ago
Reputation: 1

2 Answers


Mac OS X 10.9+ no longer uses GCC/libstdc++.

Now it uses libc++ and Clang.

bits/stdc++ is a GNU GCC extension, whereas OS X uses the clang compiler. However, we can still make it work by manually creating the header file.

Inside the directory /usr/local/include create a bits directory, inside bits directory make a file called stdc++.h and paste the contents of stdc++.h. Now it should compile as expected.

$ cd /usr/local/include
$ mkdir bits
$ cd bits
$ nano stdc++.h

paste the content from the link and save.

answered 2 years, 3 months ago
Reputation: 1

Still it says the same

hello.cpp:1:10: fatal error: ‘bits/stdc++.h’ file not found
1 error generated.

answered 8 months, 2 weeks ago
Reputation: 1

Your Answer

Nothing to preview

Post Answer

Asked:  2 years, 3 months ago
Viewed:  5771 times
Active:  8 months, 2 weeks ago