Click here to Skip to main content
16,001,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 20-Jul-10 22:26pm
v3

// C4439.cpp
// compile with: /clr
void __stdcall f( System::String^ arg ) {} // C4439
void __clrcall f2( System::String^ arg ) {} // OK
void f3( System::String^ arg ) {} // OK

Hi, I am a newbi too.
To convert _stdcall into _clrcall in Calling Convertion , It maybe solve your problem.But i am not sure. ;P
 
Share this answer
 
v2
Check the project options about the support of CLR and managed code: probably the debug and the release ones are incoherent.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900