This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?

(34个答案)


6年前关闭。




按以下说明尝试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的依赖项添加到项目属性中(在链接器设置下查找“其他库”或类似内容)。

关于c++ - PathFileExists导致链接器错误2028/2019 ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26956887/

10-12 21:31