1
Development - (fb2k) / Failed linking with GetOpenFileName
Last post by mortalis -Maybe someone had this problem or could point me to its root...
Trying to call GetOpenFileName() method from Windows SDK (comdlg32.h), but during linking it fails with the following:
Code: [Select]
mainmenu.obj : error LNK2001: unresolved external symbol __imp_GetOpenFileNameW
SDK-2023-09-23\foobar2000\foo_sample\x64\Release\foo_sample.dll : fatal error LNK1120: 1 unresolved externals
I just included this minimal chunk to the mainmenu.cpp of the foo_sample project from the SDK-2023-09-23, in the execute() method.
Code: [Select]
OPENFILENAME ofn;
GetOpenFileName(&ofn);
I found that the method should be in the comdlg.lib of the Windows SDK 10. I tried with 10.0.20348.0 which should have the method, according to this:
https://learn.microsoft.com/en-us/windows/win32/api/commdlg/nf-commdlg-getopenfilenamew
Checked in the project properties that it points to that version.
And the .lib is there of course.
The verbose build log also contains the path to the directory with the .lib, although it's huge and I'm not exactly sure where to look.
I can attach the full log if someone needs it, but it should be reproducible on another PC I think.
Weird thing is that I found GetOpenFileName in the shared library in the foobar SDK, and it builds.
Also, when I build a minimal console app in Visual Studio with that chunk, plus include <windows.h>, it build without errors (in exe and dll modes).
Thanks.