Home Dashboard Directory Help
Search

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


Status: 

Closed
 as By Design Help for as By Design


2
0
Sign in
to vote
Type: Bug
ID: 622227
Opened: 11/16/2010 5:15:36 AM
Access Restriction: Public
1
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Hi!

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.


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

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)
Sign in to post a workaround.
Posted by Adria C on 2/20/2012 at 4:04 AM
Hi!

I found the same problem in a project I actually develop.

In my case, the link error is solved deleting the [projectname].dll.metagen file in .Debug (or .Release) folder, and building the project/solution. I think that re-buiding isn't necessary, at least in my situation.

The Clean command doesn't delete this file.
File Name Submitted By Submitted On File Size  
VS2010LinkerProblemDemo.zip 11/16/2010 12.18 MB
VS2010LinkerProblemDemo.zip 11/23/2010 25 KB