【问题标题】:Why Visual Studio cannot find 'tr1/unordered_map?为什么 Visual Studio 找不到 'tr1/unordered_map?
【发布时间】:2011-03-11 12:43:54
【问题描述】:

我想在项目中使用 google-ctemplate。但如果我包含基本文件,我会收到以下错误(使用 Visual Studio C++ 2005):

Error   1   fatal error C1083: Cannot open include file: 'tr1/unordered_map': No such file or directory f:\entwicklung\libraries\ctemplate-0.99\src\ctemplate\template_cache.h  39

我可以在 boost-directory 中找到 unordered_map.hpp,并且 boost-directory 是在 Visual Studio 的包含路径中设置的。我该如何解决这个问题?

【问题讨论】:

    标签: visual-studio boost visual-studio-2005 tr1 unordered-map


    【解决方案1】:

    我发现了问题所在。我从 google-ctemplate 中包含了错误的目录。而不是src,我必须使用src/windows

    但这会引发另一个问题,这次来自链接器。

    【讨论】:

      【解决方案2】:

      按原样,您可以使用:

      #include <boost/tr1/unordered_map.hpp>
      

      或者,将您的 $(boost-directory)/boost/tr1/tr1 添加到包含路径并使用:

      #include <unordered_map>
      

      查看Header Include Style了解更多详情。

      注意:我假设 $(boost-directory) 设置为“C:\boost_1_46_0”。

      【讨论】:

        【解决方案3】:

        考虑到 TR1 直到 2005 年夏天才发布,我不会对它在 VS 2005 中不存在感到惊讶。您可以尝试更新版本的编译器!

        【讨论】:

          猜你喜欢
          • 2023-03-12
          • 2012-12-06
          • 2019-02-16
          • 2011-07-13
          • 1970-01-01
          • 2023-03-30
          • 1970-01-01
          • 2011-08-06
          • 2010-09-07
          相关资源
          最近更新 更多