error C3121 : cannot change GUID
Hi
I have this ATL project, and after I compiled I get the error says
"error C3121 : cannot change GUID for class '_IUtilEvents' "
the code where there's an error is at /* dispinterface */ _IUtilEvents;
here's the snapshot of the part of the code from the .tlh file
struct __declspec(uuid("a0de2708-e7b3-42b4-a929-4cb72e613b0f"))
/* LIBID */ __INI;
[export] __interface __declspec(uuid("715838d3-98ec-4f40-8f0e-48e5d3bfbb38"))
/* dispinterface */ _IUtilEvents;
struct /* coclass */ CUtil;
[export] __interface __declspec(uuid("9f9f979b-3a12-4b06-96e1-9b50bd586f43"))
/* dual interface */ IUtil;
I googled and found this error on msdn website, but honestly, I dont understand what they're talking about. I dont know what I should do it fix it. Have u ever had this error before? If so, how did u fix it?
Thanks
Re: error C3121 : cannot change GUID
Can you post the code that is causing the error?
Re: error C3121 : cannot change GUID
I wish I could post the whole project of the code, but I would be fired if I do that...
This is the file that the compiler complains
The error is
error C3121: cannot change GUID for class '_IUtilEvents'
error C3121: cannot change GUID for class '_IUtilEvents'
I type "it complains here" above the line the compiler complains the error.
//
// Forward references and typedefs
//
struct __declspec(uuid("a0de2708-e7b3-42b4-a929-4cb72e613b0f"))
/* LIBID */ __INI;
//---------------------it complains here----------------------------
[export] __interface __declspec(uuid("715838d3-98ec-4f40-8f0e-48e5d3bfbb38"))
/* dispinterface */ _IUtilEvents;
struct /* coclass */ CUtil;
[export] __interface __declspec(uuid("9f9f979b-3a12-4b06-96e1-9b50bd586f43"))
/* dual interface */ IUtil;
//
// Smart pointer typedef declarations
//
_COM_SMARTPTR_TYPEDEF(_IUtilEvents, __uuidof(_IUtilEvents));
_COM_SMARTPTR_TYPEDEF(IUtil, __uuidof(IUtil));
//
// Type library items
//
//------------------- and it complains here ---------------------
[uuid("715838d3-98ec-4f40-8f0e-48e5d3bfbb38"),dispinterface]
__interface _IUtilEvents : IDispatch
{};
struct __declspec(uuid("b053dad9-8f44-4ca6-b278-00521003ec11"))
CUtil;
// [ default ] interface IUtil
// [ default, source ] dispinterface _IUtilEvents
[uuid("9f9f979b-3a12-4b06-96e1-9b50bd586f43"),dual]
__interface IUtil : IDispatch
{
//
// Raw methods provided by interface
//
[id(0x1)] HRESULT __stdcall Read (
[in] BSTR Filename );
[id(0x2)] HRESULT __stdcall Write (
[in] BSTR Filename );
[id(0x3)] HRESULT __stdcall GetKeywordValue (
[in] BSTR Section,
[in] BSTR Keyword,
[out] VARIANT * Value,
[out] BSTR * Format,
[out] VARIANT_BOOL * ReadStatus );
[id(0x4)] HRESULT __stdcall SetKeywordValue (
[in] BSTR Section,
[in] BSTR Keyword,
[in] VARIANT Value,
[in] BSTR Format );
[id(0x5)] HRESULT __stdcall Clear ( );
[id(0x6),propget] HRESULT __stdcall NumSections (
[out,retval] short * pVal );
[id(0x7),propget] HRESULT __stdcall SectionName (
[in] short Index,
[out,retval] BSTR * pVal );
[id(0x8),propget] HRESULT __stdcall NumKeywords (
[in] BSTR Section,
[out,retval] short * pVal );
[id(0x9),propget] HRESULT __stdcall Keyword (
[in] BSTR Section,
[in] short Index,
[out,retval] BSTR * pVal );
[id(0xa),propget] HRESULT __stdcall ReadSectionExist (
[in] BSTR Filename,
[in] BSTR Section,
[out,retval] VARIANT_BOOL * pVal );
[id(0xb)] HRESULT __stdcall ReadKeywords (
[in] BSTR Filename );
[id(0xc)] HRESULT __stdcall RemoveKeyword (
[in] BSTR Section,
[in] BSTR Keyword );
};
//
// Named GUID constants initializations
//
extern "C" const GUID __declspec(selectany) LIBID_INI =
{0xa0de2708,0xe7b3,0x42b4,{0xa9,0x29,0x4c,0xb7,0x2e,0x61,0x3b,0x0f}};
extern "C" const GUID __declspec(selectany) DIID__IUtilEvents =
{0x715838d3,0x98ec,0x4f40,{0x8f,0x0e,0x48,0xe5,0xd3,0xbf,0xbb,0x38}};
extern "C" const GUID __declspec(selectany) CLSID_CUtil =
{0xb053dad9,0x8f44,0x4ca6,{0xb2,0x78,0x00,0x52,0x10,0x03,0xec,0x11}};
extern "C" const GUID __declspec(selectany) IID_IUtil =
{0x9f9f979b,0x3a12,0x4b06,{0x96,0xe1,0x9b,0x50,0xbd,0x58,0x6f,0x43}};
I tried to delete one of the lines in the code that the compiler complains, but this file (_ini.tlh) gets created automatically every time I compile my code...how do I fix this?
thanks
Re: error C3121 : cannot change GUID
By the way, I just found out that the code automatically generate the .tlh file because I have this
#import "_INI.tlb" no_namespace, named_guids, embedded_idl