MFC程序链接时的错误error LNK2022: 元数据操作失败(8013118D) : 重复类型(__POSITION)中的布局信息不一致:(0x02000074)。
LINK : fatal error LNK1255: 由于元数据错误,链接失败
会是与哪些冲突了?

解决方案 »

  1.   

    是这样的 我感觉问题出在Streams.h这个DirectShow的系统头文件里   它里面包含了很多DirectShow的文件   ..
      

  2.   

    MSDN的说明
    Linker Tools Error LNK2022
    metadata operation failed (HRESULT) : error_messageThe linker detected an error while merging metadata. The metadata errors must be resolved to link successfully.One reason for LNK2022 is when a struct exists in multiple modules with the same name, but with conflicting definitions, and when you compile with /clr.
    你可能有重定义的结构,感觉与LN2005有同样的问题(LN2005是函数重定义)
    你可以参考关于LN2005的解决办法http://community.csdn.net/Expert/topic/4035/4035191.xml?temp=.8737604
      

  3.   

    可是Streams.h是个系统头文件..  它里面包含的都是自带的direct头  那么会不会是头文件的包含顺序之类的问题?
      

  4.   

    是不是链接dll的时候出现这样子的错误的?
      

  5.   

    导致 LNK2022 的一个原因是当一个结构位于多个同名模块中,但定义冲突,并且您用 /clr 进行编译时。
      

  6.   

    Symptoms
    When you declare anonymous structures globally and then compile the structures as managed code, you may receive the following (or similar) linker error messages: error LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types ($ArrayType$0x1078d980): (0x02000002).
    LINK : fatal error LNK1255: link failed because of metadata errors Cause
    This behavior occurs because the compiler generated incorrect metadata for these anonymous structures. Resolution
    To resolve this problem, add unique identifiers when you use Managed Extensions for C++ so that you avoid using anonymous structures as global variables. Status
    Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.More Information
    The following code demonstrates the problem: //c1.cpp
    //Compiler option required: /clr
    struct { int i; }a1[] = { {1}, {2}, {3}, {4} };
    void FuncA(int i) { a1[i].i = i; }
    //End of c1.cpp//c2.cpp<BR/>
    //Compiler option required: /clr
    struct { int i,k; } a2[] = { {1,2}, {3,4}, {4,5}, {5,6} };
    void FuncA(int);void main() {
          FuncA(a2[1].k);
    }
    //End of c2.cpp 
      

  7.   

    最新发现我终于找到重定义的POSITIN的地方了 在DirectShow 的自带文件wxlist.h中有这么几行  大家帮我看看是怎么回事  /* This definition is the same as the POSITION type for MFCs, so we must
      */ avoid defining it twice.
      
    #ifndef __AFX_H__
    struct __POSITION { int unused; };
    typedef __POSITION* POSITION;
    #endif