【发布时间】:2016-06-16 08:27:23
【问题描述】:
我的项目在 Visual Studio 2012 中正常工作和编译。但是我试图在具有 VS 2015 的计算机中打开它,但出现 156 个错误。所有相同且都在同一个文件和相同的 3 行中: 严重性代码描述项目文件行抑制状态
Error C2338 The C++ Standard forbids containers of const elements because allocator<const T> is ill-formed. leaf c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 585
Error C2535 'const long *std::allocator<_Ty>::address(const long &) noexcept const': member function already defined or declared leaf c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 613
Error C2535 'const long *std::_Wrap_alloc<std::allocator<_Ty>>::address(const long &) const': member function already defined or declared leaf c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 846
我只得到同样的 3 个错误 52 次,总共 156 次。我的代码没有一个错误,都是这个 xmemory0 文件。
【问题讨论】:
-
请多多MCVE
-
您不是要在 STL 容器中保存对某些内容的引用吗?还是常量? connect.microsoft.com/VisualStudio/feedbackdetail/view/949932/…
-
@SamiKuhmonen 似乎已经解决了这个问题,但如果有人知道任何方法来跟踪这些问题的根源,我将不胜感激(错误没有显示它们发生在哪个文件中)
-
第一次尝试是在文件中查找
标签: c++ visual-studio visual-studio-2012 compiler-errors visual-studio-2015