S. Nurbe said:
probably this is a common problem but I couldn't find yet a proper
solution (and I hope there is one).
I think the only solution to this problem was discussed in this
forum several times. You might, however, not like the answer:
essentially, you have no alternative than changing the code to
use the standard headers.
Is it somehow possible to put them together to one framework and solve
the iostream problem (also other header are effected, e.g. fstream)?
Yes: change all uses of the .h-headers to uses of the standard
headers. Since the standard headers define their names in namespace
'std' you also need to change your code to search the names therein.
The easiest approach for a transistion like this is to use a using
directive, that is, you would change
| #include <iostream.h>
to become
| #include <iostream>
| using namespace std;
Using namespace directives like above, especially in headers, is
frowned upon and should normally not be done. However, it is a
viable approach if you need to port pre-standard C++ code. The
uses should eventually be removed and new code should neither
introduce them nor assume they are used somewhere else.
An approach easing this transistion is to provide your own version
of the .h-headers which look essentially like this:
| // file: mystd/iostream.h
| #if !defined(MYSTD_IOSTREAM_H)
| #define MYSTD_IOSTREAM_H 1
| # include <iostream>
| using namespace std;
| #endif /* MYSTD_IOSTREAM */
You would then direct the compiler to search the directory where
you put the headers first, typically with an option looking like
this: '-Imystd' (without the delimiting quotes, of course).
The remaining problems should be simple to resolve. Essentially,
only a few unnecessary flags (like 'ios::nocreate') were defined
in the pre-standard headers. You might also encounter uses of
'opfx()', 'osfx()', 'ipfx()', or 'isfx()' which are unavailable.
These are replaced by uses of 'std:
stream::sentry' and
'std::istream::sentry' but actually this is quite unlikely
(unless you had an IOStream expert in your team...). I don't
remember any other problems from the transistion (but then, I'm
quite familiar with the IOStreams library and just fix the code
rather than thinking much about it).
If I just change the header in one framework I get lots of errors,
which are very difficult to fix (at least for me).
There shouldn't be any problems which are difficult to fix. If
you did as described above and you are still stuck with a problem
I'm sure you can get help in this forum: just post a short excerpt
which displays the problems (you might want to search the group
archives for the respective problem before that since I remember
helping people with resolving the transistion problems before).