Re: how to use COM component?



"kren" <kren999@xxxxxxx> writes:

when i compile the file
#include <stdio.h>
#include "msxml.h"

int main(void) {

HRESULT hr;
IXMLDOMDocument *doc = NULL;

CoInitialize(NULL);
hr = CoCreateInstance(&CLSID_DOMDocument,
NULL, CLSCTX_INPROC,
&IID_IXMLDOMDocument,
(void **)&doc);

if (SUCCEEDED(hr)) {
doc->Release();
}
else
printf("Error creating MSXML instance. 0x%x\n", hr);
CoUninitialize();
return 0;
}

Wedit output
Error e:\computer\mylib\xml\xml.c 15 undefined reference to
_IID__Recordset
Error e:\computer\mylib\xml\xml.c 15 undefined reference to
_CLSID_Recordset

is why??
You have not linked against the proper libraries
you have to add
ole32.lib oleaut32.lib

to the Projects->Configuration->Linker
Additonal files to be included in the link

Regards
Friedrich

--
Please remove just-for-news- to reply via e-mail.
.