I'm trying to create an .lnk file programatically. I would prefer to use C, but C++ is fine (and is what all the MSDN stuff is in).
The relevant code sample is:
#include <windows.h>
#include <shobjidl.h>
#include <shlguid.h>
HRESULT CreateLink(LPCSTR lpszPathObj, LPCSTR lpszPathLink, LPCSTR lpszDesc) {
HRESULT hres;
IShellLink* psl;
/* Get a pointer to the IShellLink interface. */
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
IID_IShellLink, (LPVOID*)&psl);
return hres;
}
I'm trying to comple with wineg++ using:
wineg++ -mno-cygwin -o t t2.cpp
And I'm getting the following errors:
t2-Tw9YPp.o: In function `CreateLink(char const*, char const*, char const*)': t2.cpp:(.text+0x34): undefined reference to `IID_IShellLinkA' /usr/bin/ld: t2-Tw9YPp.o: relocation R_386_GOTOFF against undefined hidden symbol `IID_IShellLinkA' can not be used when making a shared object /usr/bin/ld: final link failed: Bad value collect2: ld returned 1 exit status winegcc: i486-linux-gnu-g++ failed
Any ideas?