错误C4439“主要" [英] Error C4439 'main'
问题描述
大家好,
我是VC ++的新手,这是我的第一个独立项目,请原谅我的无知!
我的项目可以在Debug模式下编译并运行良好.
但是,当我尝试在发布模式下编译它时(我需要使用它来使用安装向导进行应用程序部署),我得到以下错误:
错误C4439:"main":签名中具有托管类型的函数定义必须具有__clrcall调用约定
我正在使用以下参数:
呼叫约定:_stdcall(/Gz)
公共语言运行时支持(/clr)
运行时库:多线程DLL(/MD)
我还在项目属性的其他依赖项"中添加了库文件ole32.lib.
当我尝试使用:
int __clrcall main(array<System::String ^> ^args)
我收到以下链接错误:
error LNK2001: unresolved external symbol "extern "C" void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@$$J14YGXPAU_GUID@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" void * __stdcall SetupDiGetClassDevsA(struct _GUID const *,char const *,struct HWND__ *,unsigned long)" (?SetupDiGetClassDevsA@@$$J216YGPAXPBU_GUID@@PBDPAUHWND__@@K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)" (?SetupDiEnumDeviceInterfaces@@$$J220YGHPAXPAU_SP_DEVINFO_DATA@@PBU_GUID@@ KPAU_SP_DEVICE_INTERFACE_DATA@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiGetDeviceInterfaceDetailA(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A *,unsigned long,unsigned long *,struct _SP_DEVINFO_DATA *)" (?SetupDiGetDeviceInterfaceDetailA@@$$J224YGHPAXPAU_SP_DEVICE_INTERFACE_DATA@@PAU_SP_DEVICE_INTERFACE_DETAIL_DATA_A@@KPAKPAU_SP_DEVINFO_DATA@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@$$J18YGEPAXPAU_HIDD_ATTRIBUTES@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiDestroyDeviceInfoList(void *)" (?SetupDiDestroyDeviceInfoList@@$$J14YGHPAX@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_SetOutputReport(void *,void *,unsigned long)" (?HidD_SetOutputReport@@$$J212YGEPAX0K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_GetInputReport(void *,void *,unsigned long)" (?HidD_GetInputReport@@$$J212YGEPAX0K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall UuidCreate(struct _GUID *)" (?UuidCreate@@$$J14YGJPAU_GUID@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall UuidToStringA(struct _GUID const *,unsigned char * *)" (?UuidToStringA@@$$J18YGJPBU_GUID@@PAPAE@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall RpcStringFreeA(unsigned char * *)" (?RpcStringFreeA@@$$J14YGJPAPAE@Z) 1>C:\Documents and Settings\bandu\My Documents\Visual Studio 2008\Projects\13th July - TES GUI wshid\GUI\Release\GUI.exe : fatal error LNK1120: 11 unresolved externals
请帮忙!! :(
Soorali
J14YGXPAU_GUID @@@@ Z) 1> GUI.obj:错误LNK2001:未解析的外部符号"extern"C" void * __stdcall SetupDiGetClassDevsA(struct _GUID const *,char const *,struct HWND__ *,unsigned long)(?SetupDiGetClassDevsA @@
J216YGPAXPBU_GUID @@ PBDPAUHWND __ @@ K @ Z) 1> GUI.obj:错误LNK2001:未解析的外部符号"extern"C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)(?SetupDiEnumDeviceInterfaces @
J220YGHPAXPAU_SP_DEVINFO_DATA @@ PBU_GUID @@ KPAU_SP_DEVICE_INTERFACE_DATA @@@ Z) 1> GUI.obj:错误LNK2001:未解析的外部符号"extern"C" int __stdcall SetupDiGetDeviceInterfaceDetailA(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A *,unsigned long,unsigned long *,struct _SP_DEVINFO_up /blockquote>
Hi All,
I am a newbie to VC++ and this is my first independent project so please pardon my ignorance!!
My project compiles and runs perfectly fine in Debug mode.
However, when I try to compile it in Release mode ( I need this to use the Setup wizard for application Deployment) I get the following error:
error C4439: ''main'' : function definition with a managed type in the signature must have a __clrcall calling convention
I am using the following parameters:
Calling Convention : _stdcall (/Gz)
Common Language Runtime Support (/clr)
Runtime Library: Multi-threaded DLL (/MD)
I have also added the library file ole32.lib in the Additional Dependancies in the Project Property.
When I try to use :
int __clrcall main(array<System::String ^> ^args)
I get the following Link errors:
error LNK2001: unresolved external symbol "extern "C" void __stdcall HidD_GetHidGuid(struct _GUID *)" (?HidD_GetHidGuid@@$$J14YGXPAU_GUID@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" void * __stdcall SetupDiGetClassDevsA(struct _GUID const *,char const *,struct HWND__ *,unsigned long)" (?SetupDiGetClassDevsA@@$$J216YGPAXPBU_GUID@@PBDPAUHWND__@@K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)" (?SetupDiEnumDeviceInterfaces@@$$J220YGHPAXPAU_SP_DEVINFO_DATA@@PBU_GUID@@ KPAU_SP_DEVICE_INTERFACE_DATA@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiGetDeviceInterfaceDetailA(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A *,unsigned long,unsigned long *,struct _SP_DEVINFO_DATA *)" (?SetupDiGetDeviceInterfaceDetailA@@$$J224YGHPAXPAU_SP_DEVICE_INTERFACE_DATA@@PAU_SP_DEVICE_INTERFACE_DETAIL_DATA_A@@KPAKPAU_SP_DEVINFO_DATA@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_GetAttributes(void *,struct _HIDD_ATTRIBUTES *)" (?HidD_GetAttributes@@$$J18YGEPAXPAU_HIDD_ATTRIBUTES@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiDestroyDeviceInfoList(void *)" (?SetupDiDestroyDeviceInfoList@@$$J14YGHPAX@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_SetOutputReport(void *,void *,unsigned long)" (?HidD_SetOutputReport@@$$J212YGEPAX0K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" unsigned char __stdcall HidD_GetInputReport(void *,void *,unsigned long)" (?HidD_GetInputReport@@$$J212YGEPAX0K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall UuidCreate(struct _GUID *)" (?UuidCreate@@$$J14YGJPAU_GUID@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall UuidToStringA(struct _GUID const *,unsigned char * *)" (?UuidToStringA@@$$J18YGJPBU_GUID@@PAPAE@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" long __stdcall RpcStringFreeA(unsigned char * *)" (?RpcStringFreeA@@$$J14YGJPAPAE@Z) 1>C:\Documents and Settings\bandu\My Documents\Visual Studio 2008\Projects\13th July - TES GUI wshid\GUI\Release\GUI.exe : fatal error LNK1120: 11 unresolved externals
Please Help!! :(
Soorali解决方案J14YGXPAU_GUID@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" void * __stdcall SetupDiGetClassDevsA(struct _GUID const *,char const *,struct HWND__ *,unsigned long)" (?SetupDiGetClassDevsA@@
J216YGPAXPBU_GUID@@PBDPAUHWND__@@K@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiEnumDeviceInterfaces(void *,struct _SP_DEVINFO_DATA *,struct _GUID const *,unsigned long,struct _SP_DEVICE_INTERFACE_DATA *)" (?SetupDiEnumDeviceInterfaces@@
J220YGHPAXPAU_SP_DEVINFO_DATA@@PBU_GUID@@ KPAU_SP_DEVICE_INTERFACE_DATA@@@Z) 1>GUI.obj : error LNK2001: unresolved external symbol "extern "C" int __stdcall SetupDiGetDeviceInterfaceDetailA(void *,struct _SP_DEVICE_INTERFACE_DATA *,struct _SP_DEVICE_INTERFACE_DETAIL_DATA_A *,unsigned long,unsigned long *,struct _SP_DEVINFO_DATA *)" (?SetupDiGetDeviceInterfaceDetailA@@
这篇关于错误C4439“主要"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!