问题描述
不同的编译器似乎对TR1有不同的想法。 G ++似乎只接受类型包括:
Different compilers seem to have different ideas about TR1. G++ only seems to accept includes of the type:
#include <tr1/unordered_map>
#include <tr1/memory>
...
Microsofts编译器只接受:
While Microsofts compiler only accept:
#include <unordered_map>
#include <memory>
...
至于我理解TR1,微软的方式是正确的。
As for as I understand TR1, the Microsoft way is the correct one.
有没有办法让G ++接受第二个版本?
通常以可移植的方式处理TR1。
Is there a way to get G++ to accept the second version?How does one in general handle TR1 in a portable way?
推荐答案
>
将以下目录添加到搜索路径。
Install boost on your machine.
Add the following directory to your search path.
< Boost安装目录> / boost / tr1 / tr1
<Boost Install Directory>/boost/tr1/tr1
请参阅此处 boost tr1 a>
现在,当您加入< memory>你得到的tr1版本的内存有std :: tr1 :: shared_ptr,然后它包括平台特定版本的< memory>得到所有的正常的好东西。
Now when you include <memory> you get the tr1 version of memory that has std::tr1::shared_ptr and then it includes the platform specific version of <memory> to get all the normal goodies.
这篇关于如何包括TR1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!