Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xmemory errors in C++ project after migrating VS 2012 to VS 2015

My project works and compiles properly in Visual Studio 2012. However Im trying to open it in a computer with VS 2015 and I get 156 errors. All the same and all in the same file and same 3 lines: Severity Code Description Project File Line Suppression State

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 

I just get those same 3 errors 52 times each for a total of 156. Not a single error comes from my code, all are this xmemory0 file.

like image 837
user3713929 Avatar asked Mar 03 '16 06:03

user3713929


1 Answers

I assume you're trying to use an STL container with consts? This is prohibited by C++ standard, but an earlier version of Visual C++ allowed this. The new compiler is more standard compliant in this and will produce an error just like yours.

More information at Visual Studio Connect

Might be possible to do a simple Find in Files for "<const" to check if there's anything like that in the whole source code.

like image 146
Sami Kuhmonen Avatar answered Nov 15 '22 18:11

Sami Kuhmonen