c++ - How do I test at compile time the current version of GCC? -


i include different file depending on version of gcc. more precisely want write:

#if gcc_version >= 4.2 #  include <unordered_map> #  define ext std #elif gcc_version >= 4 #  include <tr1/unordered_map> #  define ext std #else #  include <ext/hash_map> #  define unordered_map __gnu_cxx::hash_map #  define ext __gnu_cxx #endif 

i don't care gcc before 3.2.

note: pretty sure there variable defined @ preprocessing time that, can't find again.

there number of macros should defined needs:

__gnuc__              // major __gnuc_minor__        // minor __gnuc_patchlevel__   // patch 

the version format major.minor.patch, e.g. 4.0.2

the documentation these can found here.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -