locked
Unresolved External Symbols RRS feed

  • Question

  • I am new to C++ and COM and so in order to try to learn some of it, I have been messing around with a  few different Windows API's. Today I am messing around with the core audio API and I have a for loop that looks like this:

    for (UINT i = 0; i < pDevices; i++)
    {
       pDeviceCollection->Item(i,&pDevice);
       pDevice->GetId(&deviceId);
       pDevice->OpenPropertyStore(STGM_READ,&pPropertyStore);
       pPropertyStore->GetValue(PKEY_AudioEndpoint_FormFactor,&pv);                                                                       
    }
    

    I have included the appropriate headers and there are no errors indicated in visual studio before I build. When I attempt to build and run the project it I get the following linker errors:

         Error 1 error LNK2001: unresolved external symbol PKEY_AudioEndpoint_FormFactor 

         Error 2 error LNK1120: 1 unresolved externals \Debug\ConsoleApplication9.exe ConsoleApplication9

    Any Ideas why this is happening or how I can resolve it.

    Thanks

    James

     


    James Mason Pack

    Saturday, January 26, 2013 4:24 PM

Answers

  • Try to include #include <initguid.h> (it must be the first include)
    • Edited by Fdu29 Wednesday, February 6, 2013 5:10 PM
    • Marked as answer by James Pack Saturday, February 9, 2013 4:35 AM
    Wednesday, February 6, 2013 2:14 PM

All replies

  • PKEY_AudioEndpoint_FormFactor is defined in mmdeviceapi.h.

    Do you have:

    #include <mmdeviceapi.h>
    in your code?

    • Edited by John_78f Monday, January 28, 2013 1:38 PM
    Monday, January 28, 2013 1:38 PM
  • Yes it is.


    James Mason Pack

    Saturday, February 2, 2013 5:41 AM
  • Try to include #include <initguid.h> (it must be the first include)
    • Edited by Fdu29 Wednesday, February 6, 2013 5:10 PM
    • Marked as answer by James Pack Saturday, February 9, 2013 4:35 AM
    Wednesday, February 6, 2013 2:14 PM
  • That worked! Thanks! Now can you tell me what was going on? I would appreciate it as it would help me in my journey through learning Win32 and COM programming.

    Thanks again,


    James Mason Pack

    Saturday, February 9, 2013 4:35 AM