全部博文(2005)
分类: LINUX
2009-07-09 14:45:13
In GCC 4.3 the C++ header dependencies have been . 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 defines | Header |
find, for_each, sort | algorithm |
isalnum, toupper | cctype |
INT_MIN, RAND_MAX | climits |
printf | cstdio |
atoi, free, rand | cstdlib |
EXIT_FAILURE | cstdlib |
strcmp, memcpy | cstring |
auto_ptr | memory |
fd_set, mode_t | sys/types.h |
typeid | typeinfo |
Even though GCC 4.2 has seen many delays and still hasn't been released (although it's finally getting close), a lot of development has already been done on trunk for the release of GCC 4.3. I started testing 4.3 in March and in addition to finding and reporting compiler issues I have on packages that fail to build with GCC 4.3. The idea is to give people an advance warning and to be ready for GCC 4.3 when it will be released.
We have almost 500 bugs related to GCC 4.3 already, mostly due to a clean-up of C++ headers in GCC that has exposed sloppy programming in many programs. Fortunately, these bugs are easy to fix. As I'm finding common mistakes in packages, I will document these problems and way to make sure a program is ready for GCC 4.3.
Update: there is now a that describes the most common problems people will face when moving to GCC 4.3.