none
error MIDL2337:unsatisfied forward declaration : ICustomImport[CoClass 'CustomImportAXA']

    Question

  • Hi

    I am migrating my application from vc++ 0.6 to vc++ 2013,one of the error iam facing is:

    error MIDL2337:unsatisfied forward declaration : ICustomImport[CoClass 'CustomImportAXA']

    The part of the code were iam facing error is given below, iam keeping the error indicating area as bold

    ------------------------------------CODE----------------------------------------

    library CUSTOMIMPORTAXALib
    {
     importlib("stdole32.tlb");
     importlib("stdole2.tlb");
     importlib("../CustomImportBase/CustomImport.tlb");
     importlib("../Policy/Policy.tlb");

     [
      uuid(F4C42F52-5946-11D4-B02A-40003100154B),
      helpstring("AUDI AXA CustomImport Class")
     ]
     coclass CustomImportAXA
     {
      [default] interface ICustomImport;// error
     };
     [
      uuid(F4C42F54-5946-11D4-B02A-40003100154B),
      helpstring("AUDI AXA BusinessImport Class")
     ]

    Any kind of help will be appreciated

    Thanks Ankush

    Wednesday, January 01, 2014 11:46 AM

Answers

  • Hi Ankush,

    This error tells you that the interface in question (ICustomImport) has not been defined before it has been used. Please have a check. You need to define it.

    If it is already defined in this IDL file at a later line in code, you can either move it upwards, or make a forward declaration of the same.

    If the interface is defined in another IDL file, ensure that an import declaration for this one exists at the top of the errant IDL file.

    Here is a blog about "Fixing "Unsatisfied forward declaration" error from MIDL" that will help you a lot.

    Best regards,

    Sunny


    Thursday, January 02, 2014 8:29 AM
  • Hi All,

    This error went off by clicking on "view definition" of ICustomImport. I choose tlh file from the list and on build the error went off.

    P:S - The list that appeared on "view definition" was pointing to CustomImport.tlh and CustomImport.idl files

    • Marked as answer by jijose Thursday, March 06, 2014 8:07 AM
    Thursday, March 06, 2014 8:07 AM

All replies

  • Hi Ankush,

    This error tells you that the interface in question (ICustomImport) has not been defined before it has been used. Please have a check. You need to define it.

    If it is already defined in this IDL file at a later line in code, you can either move it upwards, or make a forward declaration of the same.

    If the interface is defined in another IDL file, ensure that an import declaration for this one exists at the top of the errant IDL file.

    Here is a blog about "Fixing "Unsatisfied forward declaration" error from MIDL" that will help you a lot.

    Best regards,

    Sunny


    Thursday, January 02, 2014 8:29 AM
  • Hiii Sunny

    I didnt exactly understood what you are telling,can you please elaborate in detail??

    iam sending my full code once again

    I am defining my error line also

    =============CODE=================

    import "oaidl.idl";
    import "ocidl.idl";

    [
     uuid(F4C42F41-5946-11D4-B02A-40003100154B),
     version(1.0),
     helpstring("CustomImportAXA 1.0 Type Library")
    ]
    library CUSTOMIMPORTAXALib
    {
     importlib("stdole32.tlb");
     importlib("stdole2.tlb");
     importlib("../CustomImportBase/CustomImport.tlb");
     importlib("../Policy/Policy.tlb");

     [
      uuid(F4C42F52-5946-11D4-B02A-40003100154B),
      helpstring("AUDI AXA CustomImport Class")
     ]
     coclass CustomImportAXA
     {
      [default] interface ICustomImport;  //error
     };
     [
      uuid(F4C42F54-5946-11D4-B02A-40003100154B),
      helpstring("AUDI AXA BusinessImport Class")
     ]
     coclass BusinessImportAXA
     {
      [default] interface IBusinessImport;
     };
    };

    ==========================CODE==========================

    I am missing Customimport.tlb file.Does this error may have occured due to that??

    Thanks Ankush

    Thursday, January 09, 2014 11:55 AM
  • Hi ankushkumar,

    I'm sorry for my unclear description.

    If you have defined ICustomImport interface in Customimport.tlb file, I think the reason of this error is you are missing Customimport.tlb file. Your error "error MIDL2337:unsatisfied forward declaration : ICustomImport[CoClass 'CustomImportAXA']" means you don't define ICustomImport interface. If you haven't, please check that you have defined ICustomImport interface before the code you post above.

    Best regards,

    Sunny

    Friday, January 10, 2014 3:10 AM
  • Hi All,

    This error went off by clicking on "view definition" of ICustomImport. I choose tlh file from the list and on build the error went off.

    P:S - The list that appeared on "view definition" was pointing to CustomImport.tlh and CustomImport.idl files

    • Marked as answer by jijose Thursday, March 06, 2014 8:07 AM
    Thursday, March 06, 2014 8:07 AM