I’m writing a small Win32 application in Visual Studio C/C++ that talks to a HID device using the WDK.
I’ve added the following include directories in Options > Projects and Solutions > VC++ Directories:
D:\WinDDK\7600.16385.1\inc\ddk
D:\WinDDK\7600.16385.1\inc\api
And the following library directory:
D:\WinDDK\7600.16385.1\lib\win7\i386
I also set the following lib file to Project Properties > Configuration Properties > Linker > Additional Dependencies:
hid.lib
But when I try to compile, I get:
error LNK2028: unresolved token (0A000040) "unsigned char __stdcall HidD_SetOutputReport(void *,void *,unsigned long)" ...
Although, this should be in hid.lib
Am I missing something ?
— Update —
At the suggestion of SooWeiTan I enabled Properties->Linker->Show Progress and now I see here the following:
1> Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\MSCOREE.lib:
1> Found __CorExeMain@0
1> Loaded MSCOREE.lib(mscoree.dll)
1> Found __IMPORT_DESCRIPTOR_mscoree
1> Referenced in MSCOREE.lib(mscoree.dll)
1> Loaded MSCOREE.lib(mscoree.dll)
1> Found mscoree_NULL_THUNK_DATA
1> Referenced in MSCOREE.lib(mscoree.dll)
1> Loaded MSCOREE.lib(mscoree.dll)
1> Searching D:\WinDDK\7600.16385.1\lib\win7\i386\hid.lib:
1> Searching C:\Program Files\Microsoft SDKs\Windows\v6.0A\\lib\kernel32.lib:
...
...
...
From this, I interpret that it doesn’t find anything interesting in the hid.lib, whereas it should find my trouble function… Any idea why this could happen ?
I’m ashamed to say that I found the problem :(. I’m C\C++ noob, but still …
When I was importing the C modules inside the c++ files, there was no
extern "C"arround the include 😐