|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - ResolveIt produces linker error
Hello,
the following code sample, included in a larger project, produces the
following linker result:
sc
main.c -cpp -Aa -r -J -mn -C -WA -ff -5 -a1 -c -g -gg -DHLDRIVER -D_DEBUG=1
-Ie:\prozess\iatinclu -Ie:\prozess\tasklib -Ie:\include -oe:\prozess\obj.tsk
\main.obj
link /CO /NOI /DE /PACKF /XN /NT /ENTRY:WinMainCRTStartup /BAS:4194304
/A:512 /RC :e:\prozess\obj.tsk\IATPROZ.RES PROCTRL.LNK
Error: e:\prozess\obj.tsk\main.OBJ(main) (21233664): Symbol Undefined
_IID_IPersistFile
Warning: c:\sc\LIB\SHELL32.LIB(shguid) (21233664): MS Precompiled TYPES not
supported
Warning: c:\sc\LIB\SHELL32.LIB(shguid) (25636263): Unknown CV version,
ignored
Lines Processed: 141786 Errors: 1 Warnings: 2
Build failed
Has someone (Jan or Walter :-)) ) an idea, what's going wrong here. I don't
have the right conclusion.
Thanks a lot
Heinz-Peter
Code sample:
#include <shlobj.h>
#include <shlguid.h>
HRESULT ResolveIt(HWND hwnd, LPCSTR lpszLinkFile, LPSTR lpszPath)
{
HRESULT hres;
IShellLink* psl;
char szGotPath[MAX_PATH];
char szDescription[MAX_PATH];
WIN32_FIND_DATA wfd;
*lpszPath = 0; // assume failure
// Get a pointer to the IShellLink interface.
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID *) &psl);
if (SUCCEEDED(hres)) {
IPersistFile* ppf;
// Get a pointer to the IPersistFile interface.
hres = psl->QueryInterface( IID_IPersistFile, (VOID **)&ppf);
if (SUCCEEDED(hres)) {
WCHAR wsz[MAX_PATH];
// Ensure that the string is Unicode.
MultiByteToWideChar(CP_ACP, 0, lpszLinkFile, -1, wsz, MAX_PATH);
// Load the shortcut.
hres = ppf->Load(wsz, STGM_READ);
if (SUCCEEDED(hres)) {
// Resolve the link.
hres = psl->Resolve(hwnd, 0);
if (SUCCEEDED(hres)) {
// Get the path to the link target.
hres = psl->GetPath(szGotPath, MAX_PATH,
(WIN32_FIND_DATA *)&wfd, SLGP_SHORTPATH );
if( FAILED(hres) ) {
}
// Get the description of the target.
hres = psl->GetDescription(szDescription, MAX_PATH);
if( FAILED(hres) ) {
}
lstrcpy(lpszPath, szGotPath);
}
}
// Release the pointer to the IPersistFile interface.
ppf->Release();
}
// Release the pointer to the IShellLink interface.
psl->Release();
}
return hres;
}
May 22 2001
Heinz-Peter Nuettgens wrote:Hello, the following code sample, included in a larger project, produces the following linker result: sc main.c -cpp -Aa -r -J -mn -C -WA -ff -5 -a1 -c -g -gg -DHLDRIVER -D_DEBUG=1 -Ie:\prozess\iatinclu -Ie:\prozess\tasklib -Ie:\include -oe:\prozess\obj.tsk \main.obj link /CO /NOI /DE /PACKF /XN /NT /ENTRY:WinMainCRTStartup /BAS:4194304 /A:512 /RC :e:\prozess\obj.tsk\IATPROZ.RES PROCTRL.LNK Error: e:\prozess\obj.tsk\main.OBJ(main) (21233664): Symbol Undefined _IID_IPersistFile May 22 2001
I tried it, and it compiles and links without error. I suggest that perhaps your library files have been corrupted or the wrong ones are being linked in. -Walter P.S. I compiled with the following command: sc test.cpp -cpp -Aa -r -J -mn -C -WA -ff -5 -a1 -c -g -gg -DHLDRIVER -D_DEBUG= 1 Heinz-Peter Nuettgens wrote in message <9edk1n$nq0$1 digitaldaemon.com>...Hello, the following code sample, included in a larger project, produces the following linker result: sc main.c -cpp -Aa -r -J -mn -C -WA -ff -5 -a1 -c -g -gg -DHLDRIVER -D_DEBUG=1 -Ie:\prozess\iatinclu -Ie:\prozess\tasklib -Ie:\include -oe:\prozess\obj.ts May 22 2001
|