Getting error when compiling debug mode: C++/CLI - error LNK2022

Posted by Yochai Timmer on Stack Overflow See other posts from Stack Overflow or by Yochai Timmer
Published on 2011-01-30T09:43:19Z Indexed on 2011/02/08 7:25 UTC
Read the original article Hit count: 262

I've got a CLI code wrapping a C++ DLL.
When i try to compile it in debug mode, i get the following error:

Error 22 error LNK2022: metadata operation failed (8013118D) :

Inconsistent layout information induplicated types .... MSVCMRTD.lib (locale0_implib.obj)

The weird thing is that on Release mode it compiles OK and works OK.
The only difference i can see that causes the problem is when i change:

Configuration Properties -> C/C++ -> Code Generation -> Runtime Library

When it's set to: Multi-threaded Debug DLL (/MDd) it throws the error.
When it's set to: Multi-threaded DLL (/MD) it compiles fine.

The same settings work for all the other DLLs in the project (CLI and C++) and they inherit the same properties.

I'm using VS2010.

So, how can i solve this ?

And can I get some explanation to WHY this is happening ?

Update:

I've basically tried changing every option in the project's properties with no luck.

I've read somewhere that this might be caused from duplicate declarations of a type of the same name.
But in the CLI file i'm calling std::string etc. explicitly from std.

Any other ideas ?

© Stack Overflow or respective owner

Related posts about visual-studio-2010

Related posts about linker