Wow, you are right. The API of both g++ and vc++ is same; just have to insert the required headers. I have the same program working for both g++ and vc++ 2005 right now.
Here is the code:

Qt Code:
  1. //VC++
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<hash_map>
  5. using namespace std;
  6. using namespace stdext;
  7. int main(int argc,char** argv)
  8. {
  9. hash_map<int,int> mapping;
  10. hash_map<int,int>::const_iterator miter;
  11.  
  12. mapping.insert(pair<int,int>(1,100));
  13. mapping.insert(pair<int,int>(2,200));
  14. miter = mapping.find(1);
  15.  
  16. if(miter == mapping.end())
  17. cout << "Not found";
  18. else
  19. cout << miter->first << " = " << miter->second;
  20.  
  21.  
  22. getchar();
  23. return 0;
  24. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. //g++
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<ext/hash_map>
  5. using namespace std;
  6. using namespace __gnu_cxx;
  7. int main(int argc,char** argv)
  8. {
  9. hash_map<int,int> mapping;
  10. hash_map<int,int>::const_iterator miter;
  11.  
  12. mapping.insert(pair<int,int>(1,100));
  13. mapping.insert(pair<int,int>(2,200));
  14. miter = mapping.find(1);
  15.  
  16. if(miter == mapping.end())
  17. cout << "Not found";
  18. else
  19. cout << miter->first << " = " << miter->second;
  20.  
  21.  
  22. getchar();
  23. return 0;
  24. }
To copy to clipboard, switch view to plain text mode 

However I am running into some problem with hash_map<string,string> for both the compilers. I am sure there is some compare function that needs to be defined for strings or is there something already available ?