Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: neilcpp on February 21, 2009, 04:52:13 pm

Title: Does codeblocks automatically #include names from C++ standard library?
Post by: neilcpp on February 21, 2009, 04:52:13 pm
Strange, but i have noticed that for some standard library routines - I dont have to state the #include directive in the source file - and it seems the names are automatically found.

for example, I can use std::exception() and std::cerr - without having to use #include <exception>.
I have noticed other automatic includes as well e.g std::string - without #include <string>

Can anyone shed any light on this?
Title: Re: Does codeblocks automatically #include names from C++ standard library?
Post by: killerbot on February 21, 2009, 05:02:59 pm
has nothing to do with CB, but with the way the header files of your files are constructed.
You were just lucky it works now, in an update it can change again. Apparently one header includes another etc .. and by that you got the thing you needed.

Just make sure you include what you need with the correct headers, see the standard.
Title: Re: Does codeblocks automatically #include names from C++ standard library?
Post by: ollydbg on February 21, 2009, 05:31:25 pm
@neilcpp
I just tested for you.

If you don't add any include file in your cpp file, then, the standard c++ files can't be parsed.