I am trying to get a list of all attached devices in a Windows OS. The only relevant article I could find was this.
Following the instructions listed there I created a small program:
#include "stdafx.h"
#include "PortableDeviceApi.h"
#include <atlbase.h>
int main()
{
CComPtr<IPortableDeviceManager> pPortableDeviceManager;
HRESULT hr = CoCreateInstance(CLSID_PortableDeviceManager,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pPortableDeviceManager));
if (FAILED(hr))
{
printf("! Failed to CoCreateInstance CLSID_PortableDeviceManager, hr = 0x%lx\n", hr);
}
return 0;
}
However, it throws the following error: LNK2001 unresolved external symbol _CLSID_PortableDeviceManager
Any suggestions as to how I can resolve this error?
Thanks!