Questions

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

0

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

#include<bits/stdc++.h>

stdcpperror_kodefork.png



asked 1 year, 10 months ago
Reputation: 1





2 Answers

0

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 1 year, 10 months ago
Reputation: 1
0

Still it says the same

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

answered 3 months, 4 weeks ago
Reputation: 1





Your Answer

Nothing to preview

Post Answer



Asked:  1 year, 10 months ago
Viewed:  4160 times
Active:  3 months, 4 weeks ago