shobjidl.h 中的第二个 C 链接
我目前正在将一个 C++ 项目从 VS6 移动到 VS2008,但是 shobjidl.h 中的许多函数都遇到以下错误
error C2733: second C linkage of overloaded function 'HWND_UserMarshal' not allowed c:\program files\microsoft sdks\windows\v6.0a\include\shobjidl.h 28830
,不仅 HWND_UserMarshall 受到影响,该标头中的其他函数也受到影响,例如 HWND_UserSize、HWND_UserFree 和 HWND_UserFree64。
我知道当使用一组不同的参数声明 extern“C”函数时会发生此错误,但是这是在 SDK 标头中,我无法更改。
有人对我下一步应该做什么有什么建议吗?
编辑:标题是 Microsoft 标题,顶部包含以下注释
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0499 */
/* Compiler settings for shobjidl.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
I am currently moving a C++ project from VS6 to VS2008, but I have come accross the following error for many of the functions in shobjidl.h
error C2733: second C linkage of overloaded function 'HWND_UserMarshal' not allowed c:\program files\microsoft sdks\windows\v6.0a\include\shobjidl.h 28830
Not just HWND_UserMarshall is affected, also other functions in this header, such as HWND_UserSize, HWND_UserFree and HWND_UserFree64.
I understand that this error occurs when an extern "C" function is declared with a different set of parameters, however this is in a SDK header, not one that I can change.
Does anyone have any suggestions of what my next steps should be?
EDIT: The header is a Microsoft header and at the top contains the following comments
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 7.00.0499 */
/* Compiler settings for shobjidl.idl:
Oicf, W1, Zp8, env=Win32 (32b run)
protocol : dce , ms_ext, c_ext, robust
error checks: allocation ref bounds_check enum stub_data
VC __declspec() decoration level:
__declspec(uuid()), __declspec(selectany), __declspec(novtable)
DECLSPEC_UUID(), MIDL_INTERFACE()
*/
//@@MIDL_FILE_HEADING( )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,我不熟悉这个标题或这些函数。但是,我怀疑 C 宏旨在根据预处理器定义来控制哪些函数对您可见。我怀疑您以某种方式定义(或未定义)预处理器符号,从而获得重复的函数定义。
由于不熟悉标题,我无法真正推荐如何才能获得您想要的功能。我可能会首先阅读文档,查看类似产品的配置,然后阅读头文件本身。
Unfortunately, I'm not familiar with this header or these functions. However, I suspect that there are C macros meant to control which functions are visible to you based on preprocessor defines. And I suspect that you somehow have defined (or not defined) preprocessor symbols in a way that you're getting duplicate function definitions.
Not being familiar with the header, I can't really recommend what to do to get just the functions you want. I would probably start by reading the documentation, looking at the configuration for similar products, and reading the header file itself.
这些标头是从 IDL 文件生成的吗?如果是这样,您可能需要使用 VS2008 兼容工具重新生成它们。
例如,如果您使用 TAO ORB,您将下载最新版本(或 2008 版本)并运行该工具:
使用适当的标志和路径。
编辑:从您的更新来看,您似乎确实应该生成此文件。 MIDL 是 Microsoft IDL 编译器。检查 MSDN 上的文档以获取有关编译器的信息: http://msdn.microsoft.com/en-us/library/windows/desktop/aa367300%28v=vs.85%29.aspx
Are those headers generated from an IDL file? If so you probably need to re-generated them using a VS2008 compliant tool.
For example if you are using the TAO ORB you would download the latest version (or the 2008 version) and run the tool:
Using appropriate flags and paths.
EDIT: From your update it does seem like you are meant to generate this file. MIDL is the Microsoft IDL compiler. Check the docs on MSDN for info on the compiler: http://msdn.microsoft.com/en-us/library/windows/desktop/aa367300%28v=vs.85%29.aspx