按照网上的例子写了一个helloworld的rpc的程序。
首先写一个my.idl文件加入到Console application的工程里面
[
     uuid("4556509F-618A-46CF-AB3D-ED736ED66477"),   // 唯一的UUID,用 GUIDGen 生成
     version(1.0)
]interface HelloWorld
{
     // 我们定义的方法
     void Hello([in,string]const char * psz);
     void Shutdown(void);
}
编译以后,把my_s.c和my_h.h加入到服务器的工程里面,在包含了main函数的文件里面实现Hello,Shutdown,MIDL_user_free和MIDL_user_allocate。链接选项加上了rpcrt4.lib。代码如下:
extern "C"{
void Hello(handle_t IDL_handle,const unsigned char*psz){
    printf("glm server:%s\n",psz);
}
void Shutdown(handle_t IDL_handle){
    RpcMgmtStopServerListening(NULL);
    RpcServerUnregisterIf(NULL,NULL,FALSE);
}
void __RPC_FAR* __RPC_USER MIDL_user_allocate(size_t len){
    return(malloc(len));
}
void __RPC_USER MIDL_user_free(void __RPC_FAR* ptr){
    free(ptr);
}
}加不加extern "C"都出现下面这样的错误:
1>my_c.obj : error LNK2001: unresolved external symbol _MIDL_user_free@4
1>my_c.obj : error LNK2001: unresolved external symbol _MIDL_user_allocate@4
1>my_c.obj : error LNK2019: unresolved external symbol _NdrClientCall2 referenced in function _Hello
1>e:\visual studio 2010\Projects\myproj\Debug\myclient.exe : fatal error LNK1120: 3 unresolved externals
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(268,5): error MSB6006: "link.exe" exited with code 1120.我应该如何解决呢?