I’m porting a solution from MSVS2005 to MSVS2012. The projects are in C++ .NET but use homemade native C++ libraires too. We had no problem building the projects with 2005 but now, I’m unable to build a project using 2012. I get the following error message:
MyFile.obj : error LNK2022: metadata operation failed (801311E4) : Duplicate managed types have different visibilities.
What does this mean? What info do you need to help me?
Thanks for your help?
I found the bug. It is a mix of everything that has been suggested here.
Somewhere in the project, a native C++ header file is included. A class in this file is made public with:
But in my own code, I include a second header that itself includes the header where the made public class is defined. So, at this point, the class is “made public” in one file and “not made public” in another file in the same project. The “duplicate with different visibilities” comes from there.
The only point that sent me on the wrong path was the error message: “Duplicate managed types have different visibilities”. But here, it is an unmanaged type.
So, if you encounter this error someday, look for a #pragma make_public(…) in the project then look for a duplicated inclusion in your problematic file.