- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you need to link in theShlwapi.lib library, i.e.:
icl prog.c Shlwapi.lib
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the compiler/linker simply cannot locate the library. Try adding the path to shlwapi.lib with the -L commandline option.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page