Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7877 Discussions

Problem with PathFileExists in Windows CE

michael_green
Beginner
847 Views
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
847 Views

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

icl prog.c Shlwapi.lib
0 Kudos
michael_green
Beginner
847 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
0 Kudos
amaigil
Beginner
847 Views
I think the compiler/linker simply cannot locate the library. Try adding the path to shlwapi.lib with the -L commandline option.
0 Kudos
Reply