CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2016
    Posts
    2

    Question Why error MIDL2272: (async) interface must derive from another (async) interface ?

    I'm getting a error MIDL2272 in line 24 when compiling the following IDL file with VS2015:
    error MIDL2272: (async) interface must derive from another (async) interface : [ Interface 'IVDAAA' ]
    Code:
    import "oaidl.idl";
    import "ocidl.idl";
    
    [
        uuid(AAAAAAAA-BBBB-AAAA-AAAA-AAAAAAAAAAAA),
        helpstring("IDLTEST 1.0 Type Library"),
        version(1.0)
    ]
    library IDLTEST
    {
        // Forward declarations of interfaces do not help here
        //interface IVDAAA;
        //interface IVDBBB;
        //interface IVDCCC;
    
        [
            uuid(AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA),
            helpstring("helpstring"),
            object,
            dual
        ]
        interface AAA : BBB
        {
        }
    
        [
            uuid(BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB),
            helpstring("helpstring"),
            object,
            dual
        ]
        interface BBB : CCC
        {
        }
    
        [
            uuid(CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC),
            helpstring("helpstring"),
            object,
            dual
        ]
    
        interface CCC : IUnknown
        {
        }
    }
    If I comment out the interface AAA block or swap the interface CCC block before interface AAA it works. (Forward declarations of interfaces do not help here)

    Has someone a explanation for this behavior or a solution? (I can't change the order of interfaces because the code is generated.)
    I found a post that this is a limitation/bug(?) in MIDL: http://marc.info/?l=ms-dcom&m=103440617319140&w=2
    Can someone confirm that MIDL is limited in the level of derived interfaces?

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,923

    Re: Why error MIDL2272: (async) interface must derive from another (async) interface

    Is this c++?? - this is a c++ programming forum!
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    Join Date
    May 2016
    Posts
    2

    Re: Why error MIDL2272: (async) interface must derive from another (async) interface

    Yes, C++/COM. => Defining COM Interfaces via IDL. I found some topics in this section that are IDL related. So because of this and because I didn't find a better matching section I asked this here.

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Why error MIDL2272: (async) interface must derive from another (async) interface

    Quote Originally Posted by tracefinder View Post
    If I comment out the interface AAA block or swap the interface CCC block before interface AAA it works. (Forward declarations of interfaces do not help here)

    Has someone a explanation for this behavior or a solution? (I can't change the order of interfaces because the code is generated.)
    As long as it depends on code generation, and you are not able to fix MIDL compiler, the only option is to fix code generation. Or tweak it some way.
    Last edited by Igor Vartanov; May 19th, 2016 at 04:36 AM.
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured