Determining libstdc++ version at compile time

Craig Rodrigues rodrigc@mediaone.net
Mon Mar 19 17:29:00 GMT 2001


Hi,

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
#else
    v2 specific iostreams code here
#endif

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?

Thanks.
-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
rodrigc@mediaone.net          



More information about the Libstdc++ mailing list