Recently, I stumbled across WinBGIm and decided to resurrect a small game I had made in turbo C++ a long time ago. Anyways, I succesfully got WinBGIm, did the necessary steps.

After removing all the errors and building the project in Visual Studio 2008 Professional, I get this error (with dopewars being the name of my cpp file) :

error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.istreambuf_iterator<char,std::char_traits<char> >): (0x0200010a). dopewars.obj

error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.ostreambuf_iterator<char,std::char_traits<char> >): (0x0200010b). dopewars.obj

error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.istreambuf_iterator<wchar_t,std::char_traits<wchar_t> >): (0x0200010c). dopewars.obj

Error 4 error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.ostreambuf_iterator<wchar_t,std::char_traits<wchar_t> >): (0x0200010d). dopewars.obj

fatal error LNK1255: link failed because of metadata errors

Kindly help me regarding what i should do to get rid of these errors. Is there a problem with my code or with something else?

What I can tell from googling around, is that this has to do with mismatched STL headers. Something about the sizes, and something about the type definitions. One solution was to sift through all the #includes, and comment them out one by one, but I see that causing more problems with the compiler. I'm wondering if maybe WinBGIm has different STL info.....
Alternatively, some reading suggests that it has to do with using anonymous structures (ie: a struct without a name) which throws the linker into madness. This claims to be fixed in 2003 (VS) however.
The only other solution that I can see, (and this part does my heart good), is to suggest switching to a good compiler/linker.... such as Code::Blocks... preferably with mingw. Anyway, if you do find a way to get this resolved, please post back.

Resource Links:
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/079a2b60-951d-4e84-affc-8d8bfaf87cab/
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/8f2a80eb-541f-4bf4-acea-61b0a35877a1/
http://social.msdn.microsoft.com/forums/en-US/vcplus2008prerelease/thread/ca795582-fac4-4648-90ee-575d42de470f/
http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/4f289f9f-6dfd-45d9-869e-4c3a1d7cd5d4/
http://www.experts-exchange.com/Programming/Editors_IDEs/C_CPP_CS/Visual_CPP/Q_23964690.html (scroll way down)
http://dobbscodetalk.com/index.php?option=com_myblog&task=view&id=251&Itemid=81
http://groups.google.co.uk/group/microsoft.public.dotnet.languages.vc/browse_frm/thread/c06892c75e734e13/29f32fac139f45d4

Maybe it's a managed/unmanaged mismatch? Did you try to use
__nogc/__gc explicitly on the type.

Nothing worked so far, so I guess I'll install VS 2005 and check if the issue is solved.

I ran into a similar problem recently and still do not know what the issue is... For me, in the Project Configuration Properties, under C++ --> Language, I turned the "Treat wchar_t as Buil-in Type" setting to "No" (compiler switch: /Zc:wchar_t-). This got rid of the LKN2022 errors involving wchar_t, but the other LKN2022 errors remain, and I don't understand what the real issue is or how to fix it...

If you have found a solution to your problem could you post it? Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.