News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Does codeblocks automatically #include names from C++ standard library?

Started by neilcpp, February 21, 2009, 04:52:13 PM

Previous topic - Next topic

neilcpp

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?

killerbot

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.

ollydbg

@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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.