路径文件存在导致链接器错误 2028/2019

PathFileExists causes Linker error 2028/2019

本文关键字:错误 2028 2019 链接 文件 存在 路径      更新时间:2023-10-16

try out PathFileExists,如下所述:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb773584%28v=vs.85%29.aspx导致链接器错误LNK2028和LNK2019。
这是我的代码:

char buffer1[] = "C:\temp\index.xml";
char *lpStr1;
lpStr1 = buffer1;
int retval;
retval = PathFileExistsA(lpStr1);
if (retval == 1 )
{
    this->lbl_stat->Text = "File found!";
}else{
    this->lbl_stat->Text = "File not found!";
}

如 MSDN 页面底部所述,您必须将 shlwapi.lib 的依赖项添加到项目属性中(在链接器设置下查找"其他库"或类似内容)。