gcc链接Netbeans中的错误

时间:2012-11-20 11:55:20

标签: c netbeans linker

我正在尝试编译一个c文件,该文件使用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库没有正确链接,但我无法正确使用它。有谁知道如何将库添加到链接器?

0 个答案:

没有答案
相关问题