c++.command-line - Symbol Undefined
- Stewie (40/40) Sep 02 2020 Hello.
Hello. I'm trying to compile a simple commandline program that uses Windows' setupapi. ---snip--- #include <windows.h> #include <setupapi.h> int main(int argc, char* argv[]) { SetupDiGetClassDevsA(0, "USB", 0, DIGCF_PRESENT); return 0; } ---snip--- c:\test\dmc test.c link test,,,user32+kernel32/noi; OPTLINK (R) for Win32 Release 8.00.16 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined _SetupDiGetClassDevsA 16 --- errorlevel 1 Ok, there's no setupapi.lib included by default in c:\dm\lib so I've imported it. c:\dm\lib\implib /s setupapi c:\windows\system32\setupapi.dll That created setupapi.lib successfully and I can find _SetupDiGetClassDevsA symbol in it. However nothing changes with the compilation: c:\test>dmc test.c setupapi.lib link test,,,setupapi+user32+kernel32/noi; OPTLINK (R) for Win32 Release 8.00.16 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined _SetupDiGetClassDevsA 16 --- errorlevel 1 Been staring at the docs for a few hours now and got nowhere. Help would be appreciated. Stewie p.s. I'm using the basic commandline tools (3MB dm857c.zip) and implib (260k bup.zip).
Sep 02 2020