Determining libstdc++ version at compile time

Craig Rodrigues
Mon Mar 19 17:29:00 GMT 2001


I'm looking at maintaining a piece of code which uses
some low-level functions in the libstdc++-v2 iostreams
implementation, and need to keep that code portable
between v2 and v3.

What is the preferred method of determining the libstdc++
version at compile time?

Someone recommended to me that using some preprocessor macro
logic like:

#if ( defined(__GNUC__) && defined(_CPP_STREAMBUF) )
    v3 specific iostreams code here
    v2 specific iostreams code here

I don't like relying on the _CPP_STREAMBUF macro.
Is there another macro which can tell me the version of 
the libstdc++ library instead?

Craig Rodrigues          

More information about the Libstdc++ mailing list