Programming/Error Case
error C2787: 'IContextMenu' : no GUID has been associated with this object
Ronie.Kang
2008. 12. 12. 12:05
아래와 같은 문제로 인해서 문제가 발생 됩니다.
문제 해결 방법은 2가지가 있습니다.
1. 원론적 문제 해결 방법
------------------------------------------------------------------------------
>I am building a shell extn. project in .net ide which is
>converted from vC++ 6.00.
>
>During buid i am getting the following error
>"error C2787: 'IContextMenu' : no GUID has been associated
>with this object", The same project works fine in VC++6.0.
>
>I have included the following files also
>#include <shlguid.h>
>#include <shobjidl.h>
>#include <shlobj.h>
>
>any help will be appreciated
This is interesting. There are two <comdef.h> header files in VC.NET, one in
Vc7/include and the other in Vc7/PlatformSDK/include. The former splits off
the smart pointer typedefs into comdefsp.h, and it doesn't include
IContextMenu. The latter does. You can try to #include the PlatformSDK
header directly, change your INCLUDE path order, or supply the missing
typedef yourself, e.g.
struct __declspec(uuid("000214e4-0000-0000-c000-000000000046"))
IContextMenu;
_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu));
--
Doug Harrison
Microsoft MVP - Visual C++
------------------------------------------------------------------------------
2. 더 간단한 방법은...
------------------------------------------------------------------------------
The response is for people that find this thread by searching for the same error.
Just define at the top of the stdafx.h file above your includes:
#define _ATL_NO_UUIDOF
------------------------------------------------------------------------------
문제 해결 방법은 2가지가 있습니다.
1. 원론적 문제 해결 방법
------------------------------------------------------------------------------
>I am building a shell extn. project in .net ide which is
>converted from vC++ 6.00.
>
>During buid i am getting the following error
>"error C2787: 'IContextMenu' : no GUID has been associated
>with this object", The same project works fine in VC++6.0.
>
>I have included the following files also
>#include <shlguid.h>
>#include <shobjidl.h>
>#include <shlobj.h>
>
>any help will be appreciated
This is interesting. There are two <comdef.h> header files in VC.NET, one in
Vc7/include and the other in Vc7/PlatformSDK/include. The former splits off
the smart pointer typedefs into comdefsp.h, and it doesn't include
IContextMenu. The latter does. You can try to #include the PlatformSDK
header directly, change your INCLUDE path order, or supply the missing
typedef yourself, e.g.
struct __declspec(uuid("000214e4-0000-0000-c000-000000000046"))
IContextMenu;
_COM_SMARTPTR_TYPEDEF(IContextMenu, __uuidof(IContextMenu));
--
Doug Harrison
Microsoft MVP - Visual C++
------------------------------------------------------------------------------
2. 더 간단한 방법은...
------------------------------------------------------------------------------
The response is for people that find this thread by searching for the same error.
Just define at the top of the stdafx.h file above your includes:
#define _ATL_NO_UUIDOF
------------------------------------------------------------------------------