1

我正在尝试编译 ac 文件,该文件使用 cygwin 在 netbeans 中打开一个通用对话框。相关代码为:

OPENFILENAME ofn;
char szFileName[MAX_PATH] = "";

ZeroMemory(&ofn, sizeof(ofn));

ofn.lStructSize = sizeof(ofn); // SEE NOTE BELOW
ofn.hwndOwner = hwnd;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = "txt";

if(GetOpenFileName(&ofn))
{
    // Do something usefull with the filename stored in szFileName 
}

编译时,我得到:

undefined reference to `__imp__GetOpenFileNameA@4'

据我了解,comdlg 库未正确链接,但我无法正确连接。有谁知道如何将库添加到链接器?

4

0 回答 0