none
LNK2001 Unresolved external symbol _IID_IMAPIProp RRS feed

  • Question

  • Hi

    I got the error "LNK2001 Unresolved external symbol _IID_IMAPIProp" while building a program using VC2015. The code causing the error is following:

    VARIANT result;

    ...

    IUnknown *pUnk = result.punkVal;
    IMAPIProp *pIProp;
    pUnk->QueryInterface(IID_IMAPIProp, (void **)&pIProp);    // *** Error caused by this instruction which refers IID_IMAPIProp

    Could someone give me a hint to fix the error?

    Thanks.


    Wednesday, March 15, 2017 7:45 PM

Answers

  • The v140 platform toolset does not include extended MAPI headers.  There are two options

    1 Download and install the headers from https://www.microsoft.com/en-us/download/details.aspx?id=12905

    2. Build with the v140_xp toolset (Windows 7.1A SDK).  This toolset does include extended MAPI headers.

    If you have extended MAPI headers you must also do something like the following to get the symbols defined for the linker -

    #define INITGUID
    #define USES_IID_IMAPIProp
    #include <Guiddef.h>
    #include <MapiX.h>
    #include <MAPIDefS.h>
    


    • Edited by RLWA32 Wednesday, March 15, 2017 8:07 PM added example
    • Proposed as answer by Eugene Astafiev Thursday, March 16, 2017 9:06 AM
    • Marked as answer by Jean Courvoyer Friday, March 17, 2017 1:37 PM
    Wednesday, March 15, 2017 8:04 PM

All replies

  • The v140 platform toolset does not include extended MAPI headers.  There are two options

    1 Download and install the headers from https://www.microsoft.com/en-us/download/details.aspx?id=12905

    2. Build with the v140_xp toolset (Windows 7.1A SDK).  This toolset does include extended MAPI headers.

    If you have extended MAPI headers you must also do something like the following to get the symbols defined for the linker -

    #define INITGUID
    #define USES_IID_IMAPIProp
    #include <Guiddef.h>
    #include <MapiX.h>
    #include <MAPIDefS.h>
    


    • Edited by RLWA32 Wednesday, March 15, 2017 8:07 PM added example
    • Proposed as answer by Eugene Astafiev Thursday, March 16, 2017 9:06 AM
    • Marked as answer by Jean Courvoyer Friday, March 17, 2017 1:37 PM
    Wednesday, March 15, 2017 8:04 PM
  • It works as you mentioned! As I already included MAPIX.H, I just add all the #define you mentioned and all works.

    Thanks a lot!

    Wednesday, March 15, 2017 9:12 PM
  • Then don't you think you should mark my response as the answer instead of your own?
    Wednesday, March 15, 2017 9:18 PM
  • I'm sorry. I'm a bit confused about 'Mark as answer'. So I've undone what I did yesterday and now I've marked your response as answer. Thanks for letting me know that.
    Friday, March 17, 2017 2:29 PM
  • I'm sorry. I'm a bit confused about 'Mark as answer'. So I've undone what I did yesterday and now I've marked your response as answer. Thanks for letting me know that.

    Thank you for following-up.  I appreciate the courtesy.
    Friday, March 17, 2017 2:33 PM