Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

Problem with PathFileExists in Windows CE

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

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

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