Aug 272013
 
Share

You will stumble upon this error if you are migrating your C++/CLI project from Visual Studio 2010 to Visual Studio 2012.

One scenario for this error is when you are setting a different visibility for a native element and another include file has already set another visibility. Something like…

#include <anotherinclude.h>
#pragma make_public(g_SomeNativeType)

Here you are trying to override a visibility set in ‘anotherinclude.h’ via make_public macro hence you see the linker error ‘duplicate managed types have different visibilities’.

This code used to compile fine in Visual Studio 2010 but errors out in Visual Studio 2012. This is a bug and it is fixed via hotfix: KB2848798.

Relevant detail from above hotfix link…

image

Share

Leave a Reply