none
MMDeviceapi

    Question

  • Hi all,

    I'm trying to compile some sample codes from the white paper. The sample codes enumerates the audio end points and print out the display name. I've included mmdeviceapi.h and propkey.h but got failures.

    The following are the linking errors

    error LNK2001: unresolved external symbol _PKEY_DisplayName

    error LNK2001: unresolved external symbol _CLSID_MMDeviceEnumerator

    error LNK2001: unresolved external symbol _IID_IMMDeviceEnumerator

    Can anyone tell me what's wrong with it? Do I need to include more files? Thanks in advance

    Friday, January 27, 2006 3:32 AM

Answers

  • same problem, but easy solution


        hResult = CoCreateInstance(
                 __uuidof(MMDeviceEnumerator), NULL,CLSCTX_INPROC_SERVER,
                 __uuidof(IMMDeviceEnumerator),
                 (void**)&paWasapi->enumerator);


    Friday, March 31, 2006 5:16 PM

All replies

  • I had same problem , but no answer from Microsoft ?
    Friday, March 31, 2006 9:26 AM
  • same problem, but easy solution


        hResult = CoCreateInstance(
                 __uuidof(MMDeviceEnumerator), NULL,CLSCTX_INPROC_SERVER,
                 __uuidof(IMMDeviceEnumerator),
                 (void**)&paWasapi->enumerator);


    Friday, March 31, 2006 5:16 PM
  • you can use:

     hResult = spProperties->GetValue(PKEY_Device_FriendlyName, &value);

    for the device name, just like in the Mic Array example
    Friday, March 31, 2006 5:17 PM
  • Dear plgDavid :

    thank you for your help , I use __uuidof() is work .

    Friday, April 07, 2006 2:59 AM
  • but how to solve these problems

    ....

    Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Error 2 error C2146: syntax error : missing ';' before identifier 'PKEY_Audio_ChannelCount'
    Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Error 5 error C2146: syntax error : missing ';' before identifier 'PKEY_Audio_Compression'
    Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    ....

    Error 300 fatal error C1003: error count exceeds 100; stopping compilation

    ....

    if my project is empty and i ONLY included these files

    #include <Audioclient.h>
    #include <Audiopolicy.h>
    #include <propkey.h>
    #include <Mmdeviceapi.h>

    ?

    I want to have empty mfc dialog project (made by the creator) with these files included ;)

    Monday, January 29, 2007 10:13 AM