Vivek Krishna wrote:
Hi ,
I am writing code that makes use of certain C++ STL features (ex
hash_map) and their usage is slightly different between versions<3.3
and versions beyond 3.3 ,such as which file to include (ext/hash_map
or hash_map ) and whether to define the __gnu_cxx namespace. I want to
be able to detect using a macro (preferably ) which g++ version I am
using and write code for accordingly ..Is this possible.
Vivek
First of all, you're off-topic in comp.lang.c++ (dunno about the other
group). This question would rather belong in gnu.g++.help. And then yes, of
course you can find out the version. On a un*x system, do:
echo | g++ -E -x c++ -dm -
and you'll see a list of all pre-defined macros. I can see things like:
#define __GNUC__ 3
#define __GNUC_MINOR__ 3
#define __GNUC_PATCHLEVEL__ 3
#define __VERSION__ "3.3.3"
in that output.