0

I'am trying to do an aplication with qt that show device description when connecting or disconnecting, but have problem with some setupapi unresolved method. This is the error that qt show

usbworker.obj:-1: error: LNK2019: unresolved external symbol __imp_SetupDiGetClassDescriptionA referenced in function "private: class ATL::CStringT<wchar_t,class StrTraitMFC_DLL<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > __cdecl usbworker::GetClassDesc(struct _GUID const *)" (?GetClassDesc@usbworker@@AEAA?AV?$CStringT@_WV?$StrTraitMFC_DLL@_WV?$ChTraitsCRT@_W@ATL@@@@@ATL@@PEBU_GUID@@@Z)

and this is a part of my code

CString usbworker::GetClassDesc(const GUID* pGuid)
{
    TCHAR buf[MAX_PATH];
    DWORD size;
    if ( SetupDiGetClassDescription(pGuid, buf, sizeof(buf), &size) ) {
        return CString(buf);
    } else {
        TRACE("Can't get class description: %s", _com_error(GetLastError()).ErrorMessage());
        return _T("");
    }
}
1201ProgramAlarm
  • 31,926
  • 7
  • 42
  • 52
  • 1
    You need to link with `Setupapi.lib` see __Requirements__ https://docs.microsoft.com/en-us/windows/win32/api/setupapi/nf-setupapi-setupdigetclassdescriptiona – Richard Critten Jun 08 '21 at 15:30

0 Answers0