r/cpp • • Mar 19 '20

Why so many students are using '#include<bits/stdc++.h>' instead of '#include<iostream>'?

I am hiring for my company. And the codes submitted for a test problem has '#include<bits/stdc++.h>' at the beginning. The MacOS default compiler complains

main.cpp:1:9: fatal error: 'bits/stdc++.h' file not found

#include<bits/stdc++.h>

^~~~~~~~~~~~~~~

1 error generated.

Why people are using '#include<bits/stdc++.h>'?

225 Upvotes

163 comments sorted by

View all comments

Show parent comments

6

u/jangid Mar 19 '20

But is this in standards? The name “stdc++.h” is misleading if it isn’t.

5

u/HKei Mar 19 '20

No, the stdc++ refers to libstdc++, which is the name of the standard library implementation that gcc is using. This is opposed to libc++ which is the default for clang (at least on OSX, I think it's actually using libstdc++ by default on linux) or whatever Microsofts implementation is called.

4

u/STL MSVC STL Dev Mar 19 '20

I call it MSVC's STL or microsoft/STL.

1

u/FrankHB1989 Mar 20 '20

I'd protested. Too many unnecessary confusions are already spread here. And this time, even by the endorsed acronym of your name... :-(

... Does WG21 people still respect teachability at all?

1

u/bumblebritches57 Ocassionally Clang Apr 13 '20

STL is his initials.