STL problems in GCC 4.1.2

Eljay Love-Jensen eljay@adobe.com
Thu Feb 21 20:17:00 GMT 2008


Hi Dave,

> The program you gave was entered verbatim, and it compiles with no errors
> and runs nicely. :)

That indicates to me that the GCC 4.1.2 Standard C++ Library (including the
STL) is probably working correctly, and something else is causing things to
go awry.

One possible culprit is that some header file somewhere (not one of the GCC
4.1.2 ones) is introducing a #define identifier that is wreaking havoc on
later #include directives due to identifier collision.  You may be able to
use g++ -E to assess where that is occurring, if it is indeed occurring.
[This is my first, best guess.]

Another possible culprit is a malformed header file.  For example, a header
with...

class Foo { }

... (notice the missing semicolon) can cause problems for subsequent headers
and/or code.

Or a header that does something naughty like...

#ifdef __cplusplus
extern "C" {
#endif
#include <this.h>
#include <that.h>
#include <theother.h>
#include <iostream>
#ifdef __cplusplus
}
#endif

... which can bollix up the embedded headers.

Or using the "old" C++ headers, like #include <iostream.h> instead of
#include <iostream> can cause problems, sometimes.

Also look for code that may not be std:: namespace savvy.

HTH,
--Eljay



More information about the Gcc-help mailing list