Visual C++ 6.0 SETUPAPI help! [modified]
-
Hi, I have only recently got back to VC++ programming and I was only a rookie when I used to program in it but now I need to create an application that can list all the devices attached to the system like "devcon.exe" does. I only just started coding it and I'm now facing a linker error that I just can't resolve! The path to my SETUPAPI.h file exists in the "Directories" under options. And I'm only calling the "SetupDiGetClassDevsEx" function. The program compiles fine but gives the following error while linking: DeviceMDlg.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsExA@24 Debug/DeviceM.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. DeviceM.exe - 2 error(s), 0 warning(s) Please help! I'm losing my mind!:) Thanks and sorry if it's a really stupid question *** What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
modified on Friday, June 5, 2009 12:36 AM
-
Hi, I have only recently got back to VC++ programming and I was only a rookie when I used to program in it but now I need to create an application that can list all the devices attached to the system like "devcon.exe" does. I only just started coding it and I'm now facing a linker error that I just can't resolve! The path to my SETUPAPI.h file exists in the "Directories" under options. And I'm only calling the "SetupDiGetClassDevsEx" function. The program compiles fine but gives the following error while linking: DeviceMDlg.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsExA@24 Debug/DeviceM.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. DeviceM.exe - 2 error(s), 0 warning(s) Please help! I'm losing my mind!:) Thanks and sorry if it's a really stupid question *** What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
modified on Friday, June 5, 2009 12:36 AM
You should add
SetupAPI.lib
to the linker input files list. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
You should add
SetupAPI.lib
to the linker input files list. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]I'm sorry if I didn't specify it earlier but please look at the extra detail I've added to the end. Is there anything else I need to do too?
-
I'm sorry if I didn't specify it earlier but please look at the extra detail I've added to the end. Is there anything else I need to do too?
I've also noticed something now. MSDN shows that SetupDiGetClassDevsEx accepts 7 parameters but I guess VC++6.0 uses an older version as the SetupAPI.h header file in the default path(~/VC98/include) accepts only 6 parameters. So I tried to use the header and lib files available with Windows DDK which has SetupDiGetClassDevsEx with 7 params. But the two seem incompatible as now it shows me 37 errors at compile time, all in the header SetupAPI.h. Any help about how to handle this?
-
Hi, I have only recently got back to VC++ programming and I was only a rookie when I used to program in it but now I need to create an application that can list all the devices attached to the system like "devcon.exe" does. I only just started coding it and I'm now facing a linker error that I just can't resolve! The path to my SETUPAPI.h file exists in the "Directories" under options. And I'm only calling the "SetupDiGetClassDevsEx" function. The program compiles fine but gives the following error while linking: DeviceMDlg.obj : error LNK2001: unresolved external symbol __imp__SetupDiGetClassDevsExA@24 Debug/DeviceM.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. DeviceM.exe - 2 error(s), 0 warning(s) Please help! I'm losing my mind!:) Thanks and sorry if it's a really stupid question *** What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
modified on Friday, June 5, 2009 12:36 AM
callousfantom wrote:
What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
You should explicitely add
SetupAPI.lib
to the list of the linker input files (I suppose it is inProject Menu->Settings
,Link
tab,Category->General->Object/library
) :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
callousfantom wrote:
What do you mean add SetupAPI.lib to the linker files list?? Paths of both header and lib file are listed under the "Include files" and "Library files" options. Also SetupAPI.h and .lib are present in the default path ~/VC98/Include and ~/VC98/Lib. I didn't add any external library. Any ideas??
You should explicitely add
SetupAPI.lib
to the list of the linker input files (I suppose it is inProject Menu->Settings
,Link
tab,Category->General->Object/library
) :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Thanks!:):thumbsup: