我链接时出现错误MyWindow.obj : error LNK2022: 元数据操作失败(8013118D) : 重复类型(__POSITION)中的布局信息不一致:(0x02000074)。
LINK : fatal error LNK1255: 由于元数据错误,链接失败我看到外国论坛上也有人和我一样的问题
那个人是这样问的:First, thanks for the update.Second, when trying to compile a .net project (e.g a brand new .net
console or library project) that has <windows.h> included i get many
linker errors like the one below:MSVCMRTD.lib(mstartup.obj) : error LNK2022: metadata operation failed
(80131195) : Custom attributes are not consistent: (0x0c000002).
[...]
LINK : fatal error LNK1255: link failed because of metadata errors
Any idea how to fix this?Thanks
然后有人回答
It took a little bit to track this down, but we did it. This is caused
because we moved the NativeEnumAttribute from Microsoft.VisualC.dll to
another assembly. The managed CRT has a few enums (probably from windows.h)
that have the old location, while your code has the new location. (I
personally think the Attribute shouldn't even be there).Anyways, this is fixed by building with a newer msvcmrt.lib or msvcmrtd.lib.
We will package that and provide it with the next refresh. We'll try to get
that done next week.I'm sorry for the inconvenience.
什么意思?

解决方案 »

  1.   

    DLL动态链接库导出类和函数的时候,各个函数或者成员都对应一个编号。不同版本的MFC动态链接库,这些编号对应关系可能有些不同。他建议用新版本的动态库重新编译。
      

  2.   

    不过建议贴出MyWindow.cpp的源代码。
    可能是其他的问题
      

  3.   

    你看不懂什么?回答吗?翻译如下:要追踪这个问题要花一点精力,但是我们做到了。这个问题的产生是因为我们从Microsoft.VisualC.dll移动了NativeEnumAttribute到其他的汇编。托管CRT有一些枚举(可能来自windows.h)使用了旧的位置,但是你的代码使用了新的位置(我个人认为这些属性不应该在那里)。不管如何这个问题通过使用新的msvcmrt.lib或者mscvmrtd.lib编译来修复。我们将会打包并且在下一个更新中提供它。我们将会试着在下个星期完成这个事情。我对此造成的不便感到抱歉。========================================
    我看这个好像是M$给出的回复吧?你似乎需要通过安装VS的更新来解决这个问题……
      

  4.   

    是这样的
    我在MFC里面用了DirectShow  采集视频
    大体框架是这样
    class MyFrame : public CFrameWnd
    {
    public:
      Capture();
    }
    在MyFrame的Capture()函数里面进行了视频采集
      

  5.   

    那个英文回复估计是microsoft的人的回复,还是比较清楚的
      

  6.   

    根据出错信息和英文回复。最可能出错的可能是程序中用到的动态链接库版本和程序中用到的该动态库的头文件的版本不一致。或者是动态链接库*.dll文件和相应导入文件的*.lib版本不一致。