Martin Michlmayr
Martin Michlmayr

I'm a member of Debian, and I work for HP as an Open Source Community Expert. The opinions expressed here are mine.

Subscribe to the RSS feed of this journal.

GCC 4.3 related build problems: missing #include

In GCC 4.3 the C++ header dependencies have been cleaned up. In the past, compilation would often be quite slow because including a simple header would indirectly include a lot of other headers, even if they were not needed to compile the current code. Many headers have now been cleaned up with the result that compilation is quicker. The downside is that programmers cannot rely on indirect inclusion of headers they may need anymore. Instead, everything that is needed has to be directly referenced with an #include.

Typical errors look like these:

error: 'find' is not a member of 'std'
error: 'exit' was not declared in this scope

Below is a table showing which header needs to be included for a number of common functions:

Functions and definesHeader
find, for_each, sortalgorithm
isalnum, touppercctype
INT_MIN, RAND_MAXclimits
printfcstdio
atoi, free, randcstdlib
EXIT_FAILUREcstdlib
strcmp, memcpycstring
auto_ptrmemory
fd_set, mode_tsys/types.h
typeidtypeinfo
Thu, 10 May 2007; 15:56 — gccpermanent link