VS2010 C++/CLI linker problem: duplicate types (LNK2022: metadata operation failed) - by Markus Werle

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 622227 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 11/16/2010 5:15:36 AM
Access Restriction Public



We encounter spurious linker problems in a C++/CLI project.
In order to reproduce the error, we finally created a stripped down mini-project (see attachment) which shows the error. The linker stage fails with (sorry for the German output):

1>MSVCMRTD.lib(locale0_implib.obj) : error LNK2022: metadata operation failed (8013118D) : Duplizierte Typen (failure) wurden gefunden, aber die Typenlayoutinformationen sind nicht konsistent: (0x02000068).
1>LINK : fatal error LNK1255: link failed because of metadata errors
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

As far as we can see it *might* have something to do with the <stdexcept> header.

Sign in to post a comment.
Posted by Microsoft on 12/1/2010 at 3:14 PM

Thanks for reporting this issue. I've resolved it as By Design because your VS2010LinkerProblemDemo.vcxproj is defining _HAS_CPP0X to 0. _HAS_CPP0X is an undocumented internal library macro, and altering it is not supported. (It appeared in VC10 because we had tests that conflicted with the newly added C++0x machinery. Adding this macro was easier than fixing the tests at the time. Among other things, the macro changes the base classes and sizes of some objects, which is why it's not supported for external use. We've updated our tests, and this macro will be removed in VC11.)

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by Markus Werle on 11/23/2010 at 7:46 AM
Update 2010-11-23: I uploaded a new zip file that removes the dependenciy from boost libraries
Posted by Microsoft on 11/16/2010 at 5:22 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)