Did you add SetupApi.lib as an additional dependency for All Platforms/All Configurations?
Getting Error LNK2019 unresolved external symbol SetupDiGetDeviceInstanceIdW() on Windows program, works on Console program
I have a piece of code that searches through USB connected serial devices looking for a specific VID & PID. I have debugged the code on a couple of console applications (SubSystem Console), and it is working correctly.
I have now moved the code into a windows form application (SubSystem Windows), and I am getting a number of the above errors. I have added the SetupAPI.lib to the linker "Additional Dependencies" in the Properties, but I still get the error.
Is there some problem with trying to use these SetupDI* calls from a "Windows" program as opposed to a "Console" application?
Right now I have the calls in the main() function, so they are not being called from inside managed code. But maybe I'm running into some other problem because it is a Window app and not a Console app.
Regards,
Greg
1 additional answer
Sort by: Most helpful
-
Greg Wilson-Lindberg 126 Reputation points
2022-12-05T16:46:04.59+00:00 @RLWA32 , you called it correctly. I'm new to using the (modern) Visual Studio, and am (obviously) not good at making sure that the properties that I'm selecting are for the build type that I have selected.
Thanks for the clue bat,
Greg