c++ - Cannot find hash_map header under Mac OSX -
#include <iostream> #include <vector> #include <list> #ifdef __gnuc__ #include <ext/hash_map> #else #include <hash_map> #endif the compiler says " hash_map: no such file or directory " need help. thank you.
on macosx correct header @ <ext/hash_map> not <hash_map>. here worked fine:
#if defined __gnuc__ || defined __apple__ #include <ext/hash_map> #else #include <hash_map> #endif int main() { using namespace __gnu_cxx; hash_map<int, int> map; } by way, prefer use <tr1/unordered_map>.
Comments
Post a Comment