The C++ 5.0 compiler provides two implementations of iostreams:
Classic iostreams. This term refers to the iostreams library shipped with the C++ 4.0, 4.0.1, 4.1, and 4.2 compilers, and earlier with the cfront-based 3.0.1 compiler. There is no standard for this library, but all existing code uses it. This library is part of libC in compatibility mode and is also available in libiostream in the standard mode.
Standard iostreams. This is part of the C++ Standard Library, libCstd, and is available only in standard mode. It is neither binary- nor source-compatible with the classic iostreams library.
If you have existing C++ sources, your code might look like the following example, which uses classic iostreams.
// file prog1.cc #include <iostream.h> int main() { cout << "Hello, world!" << endl; return 0; }
The following command compiles in compatibility mode and links prog1.cc into an executable program called prog1. The classic iostream library is part of libC, which is linked by default in compatibility mode.
demo% CC -compat prog1.cc -o prog1
The next example uses standard iostreams.
// file prog1.cc #include <iostream> int main() { std::cout << "Hello, world!" << std::endl; return 0; }
The following command compiles and links prog2.cc into an executable program called prog2. The program is compiled in standard mode and libCstd, which includes the standard iostream library, is linked by default.
demo% CC prog2.cc -o prog2