编译器找不到结构,我应该包括什么
更新: 我以为是 Windsows.hi 需要包含,并且您已经确认了这一点,但是当我包含它时,我收到了一堆类似以下的消息...
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject
我不知道如何解决这个问题,eik!
我正在尝试调用 PeekMessage 但当我尝试编译时出现以下错误。
'MSG':未声明的标识符 'HWND':未声明的标识符 'PM_REMOVE':未声明的标识符
我的代码如下...
MSG message;
while(form->Created)
{
while( PeekMessage( &message, (HWND)form->Handle.ToPointer(), 0, 0, PM_REMOVE ) )
{
TranslateMessage( &message );
DispatchMessage( &message );
if( !mainWindow->Created )
break;
}
}
我知道这些结构是什么,但可以让编译器识别它们。我是否缺少参考或者是否有 VC++ 别名'?
干杯。
UPDATE:
I thought it was Windsows.h i need to include and you have confirmed this, but when i do include it i get a bunch of messages like the following...
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(5934) : error C2872: 'IDataObject' : ambiguous symbol
1> could be 'C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\objidl.h(251) : System::Windows::Forms::IDataObject IDataObject'
1> or 'c:\windows\microsoft.net\framework\v2.0.50727\system.windows.forms.dll : System::Windows::Forms::IDataObject
I Don't know how to fix this, eik!
I'm trying to call PeekMessage but when I try to compile I get the following errors.
'MSG' : undeclared identifier
'HWND' : undeclared identifier
'PM_REMOVE' : undeclared identifier
my code is as below...
MSG message;
while(form->Created)
{
while( PeekMessage( &message, (HWND)form->Handle.ToPointer(), 0, 0, PM_REMOVE ) )
{
TranslateMessage( &message );
DispatchMessage( &message );
if( !mainWindow->Created )
break;
}
}
I know what these structures are but can get the compiler to recognise them. Am i missing a ref or are there VC++ alias' for the same?
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要包含一个包含这些定义的头文件。来自 http://msdn.microsoft.com/en -us/library/ms644943%28VS.85%29.aspx:
所以,只需这样做:
You need to include a header file containing those definitions. From http://msdn.microsoft.com/en-us/library/ms644943%28VS.85%29.aspx :
So, just do this:
当您在 C++/CLI Windows 窗体应用程序中#include windows.h 时,您会遇到一些令人讨厌的符号名称冲突。但这是自我诱导的。在 WF 应用程序中泵送您自己的消息循环不合适。它已经有一个,Application::Run()。您无法编写自己的内容,也无法适当地预处理消息以使键盘快捷键等功能正常工作。
在尝试此操作之前,请先完成一些 C++/CLI 编程教程。
You'll get several nasty symbol name collisions when you #include windows.h in a C++/CLI Windows Forms app. But this is self-induced. Pumping your own message loop in a WF app is not appropriate. It already has one, Application::Run(). You can't write your own, you won't be able to preprocess the message appropriately to make stuff like keyboard shortcuts work.
Work through some C++/CLI programming tutorials before you try this.