I have a program where I use cout to emit debug information. The code is executed in the initialization of a static global variable, i.e. quite early in the program execution. W
As Luchian has pointed out, you cannot use std::cout before the first
instance of ios_base::Init has been constructed. You don't have to
define an instance, however; including should be enough.
Order of initialization is defined within a single translation unit.
If you include at the top of all files which have static
instances, you should be OK. If the constructor of a static object
calls a function in another translation unit, however, and the output is
in that translation unit, it is not sufficient to include
only in the translation unit which does the output. You must include it
in the translation unit where the static variable(s) are defined. Even
if they don't do any output.