3

I want to use __uuidof in function CoCreateInstance:

CoCreateInstance(clsid,NULL,CLSCTX_INPROC_SERVER,__uuidof(Isesoft),(LPVOID*)&pem);

error:

'__uuidof' was not declared in this scope.

How can I use it in MINGW?

sharptooth
  • 167,383
  • 100
  • 513
  • 979
CodeCat
  • 161
  • 1
  • 5
  • 8

1 Answers1

3

__uuidof is an MS specific extension, but you should be able to replace __uuidof(IMyInterface) with IID_IMyInterface for the same behavior in a portable way.

bara
  • 374
  • 2
  • 8
  • 1
    When I used IID_IMyInterface , the error is "IID_IMyInterface was not declared in this scope". The com component that I called is a third party soft. – CodeCat Sep 04 '13 at 06:49
  • 1
    @CodeCat are you pulling in the COM interface via an `#import` directive, perchance ? If not, from where did you get the `Isesoft` interface definition? Is it from an accompanying header file with your 3rd party COM lib ? – WhozCraig Sep 04 '13 at 07:11
  • I used OLE VIEWER to get interface definition.And I have an header file with it(but the header file is not supplied by the com lib's vendor. I can't ensure it is complete right. – CodeCat Sep 04 '13 at 07:33
  • It sounds like you built you own header/idl file, so will need to include the GUID definition in you header (I'm assuming you have that from oleview). Can you add your file - especially the part where you include the interface GUID - to the question? – bara Sep 04 '13 at 17:37