Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PathFileExists causes Linker error 2028/2019 [duplicate]

trying out PathFileExists as explainded here:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb773584%28v=vs.85%29.aspx
causes Linker-Errors LNK2028 and LNK2019.
Here is my code:

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!";
}
like image 586
leatherwolf Avatar asked Nov 18 '25 03:11

leatherwolf


1 Answers

As explained at the bottom of the MSDN page, you have to add to the project properties the dependency towards shlwapi.lib (look for "additional libraries" or something like that under the linker settings).

like image 131
Matteo Italia Avatar answered Nov 20 '25 18:11

Matteo Italia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!