<p>I would like to include a different file depending on the version of GCC. More precisely I want to write:</p>

<pre><code>#if GCC_VERSION &gt;= 4.2
#  include &lt;unordered_map&gt;
#  define EXT std
#elif GCC_VERSION &gt;= 4
#  include &lt;tr1/unordered_map&gt;
#  define EXT std
#else
#  include &lt;ext/hash_map&gt;
#  define unordered_map __gnu_cxx::hash_map
#  define EXT __gnu_cxx
#endif
</code></pre>

<p>I don't care about gcc before 3.2.</p>

<p>I am pretty sure there is a variable defined at preprocessing time for that, I just can't find it again.</p>

There are a number of macros that should be defined for your needs:
```
```
__GNUC__              // major
__GNUC_MINOR__        // minor
__GNUC_PATCHLEVEL__   // patch
```
```
The version format is major.minor.patch, e.g. 4.0.2
The documentation for these can be found
here
.