首先环境是MAC OSX, gcc version 4.2.1。查看boost的目录,/usr/include/c++/4.2.1/tr1,都没有问题。
在脚本中
.... #include <tr1/unordered_map> .... unordered_map<char,int>mymap; .... |
使用g++ -o test test.cpp,报错
error: 'unordered_map' was not declared in this scope |
使用g++ -std=c++0x -o test test.cpp,报错
cc1plus: error: unrecognized command line option "-std=c++0x" |
解决办法,在脚本中加入
... using namespace std::tr1; ... |
即可。