Community
cancel
Showing results for 
Search instead for 
Did you mean: 
michaelgreen
Beginner
188 Views

Problem with PathFileExists in Windows CE

Hi All,

In my first C++ program for a Windows mobile PC I can't get PathFileExists to compile or link. In a function called PlotHeader I've got:

#include "shlwapi.h"
...
int FileExists = PathFileExists("userfile.txt");

This gives the compiler error:
error C2664: 'PathFileExistsW' : cannot convert parameter 1 from 'const char [13]' to 'LPCWSTR'

So I change the statement to:
int FileExists = PathFileExists(L"userfile.txt");

This compiles OK but gives me the following linker error:
error LNK2019: unresolved external symbol PathFileExistsW referenced in function "int __cdecl PlotHeader(struct HWND__ *,unsigned int,unsigned int,long)" (?PlotHeader@@YAHPAUHWND__@@IIJ@Z)

Can anyone explain what's going on?

With many thanks in advance
Mike
0 Kudos
3 Replies
Judith_W_Intel
Employee
188 Views


I think you need to link in theShlwapi.lib library, i.e.:

icl prog.c Shlwapi.lib
michaelgreen
Beginner
188 Views

I am a total beginner here so please forgive the dumb questions ... but how does one do that?

I have placed a reference to it in Additional Dependencies in the Linker setup, but the linker doesn't like it ... "cannot open input file 'Shlwapi.lib'"

Many thanks
Mike
amaigil
Beginner
188 Views

I think the compiler/linker simply cannot locate the library. Try adding the path to shlwapi.lib with the -L commandline option.
Reply