win32 api & lib issue
Peter Hu
peterhu.peterhu at outlook.com
Thu Nov 2 08:31:41 UTC 2023
Greetings!
From time to time I encountered issues on the subjected after I
upgraded my dmd package.Given below code :
import core.sys.windows.windows;
import core.sys.windows.commdlg;
import core.sys.windows.winuser;
extern(Windows) BOOL GetOpenFileNameW(LPOPENFILENAMEW);
extern(Windows) int MessageBoxW(HWND,LPCWSTR,LPCWSTR,UINT);
void main()
{
wchar[256] fileName;
fileName[0]=0;
OPENFILENAMEW ofn;
ofn.lStructSize=OPENFILENAMEW.sizeof;
ofn.lpstrFilter=
"Text Files\0*.txt\0 D files\0*.d;*.di\0\0"w.ptr;
ofn.lpstrFile=fileName.ptr;
ofn.nMaxFile=fileName.length;
if(GetOpenFileNameW(&ofn))
{
MessageBoxW(null,ofn.lpstrFile,"File Selected:"w.ptr,0);
}
}
The compiler failed to build this small program.It complains
GetOpenFileNameW & MessageBoxW are unresolved external symbol.
DMD 2.103+VS Community 2015+Win10 64bit.
estwinapi.obj : error LNK2019: 无法解析的外部符号
_GetOpenFileNameW at 4,该符号在函数 __Dmain 中被引用
testwinapi.obj : error LNK2019: 无法解析的外部符号 _MessageBoxW at 16,该符号在函数
__Dmain 中被引用
testwinapi.exe : fatal error LNK1120: 2 个无法解析的外部命令
Error: linker exited with status 1120
Appreciated any help on figuring me out what the issue is and how
to fix it.
More information about the Digitalmars-d-learn
mailing list