Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ Link error unresolved external symbol in MyProject_p.obj

I am trying to build a VC++ project and I get these LINK errors:

2>MyProject_p.obj : error LNK2001: unresolved external symbol _CStdStubBuffer2_Release@4
2>MyProject_p.obj : error LNK2001: unresolved external symbol _NdrStubForwardingFunction@16
2>MyProject_p.obj : error LNK2001: unresolved external symbol _IUnknown_Release_Proxy@4
2>MyProject_p.obj : error LNK2001: unresolved external symbol _IUnknown_AddRef_Proxy@4
2>MyProject_p.obj : error LNK2001: unresolved external symbol _IUnknown_QueryInterface_Proxy@12
2>MyProject_p.obj : error LNK2001: unresolved external symbol _NdrOleFree@4
2>MyProject_p.obj : error LNK2001: unresolved external symbol _NdrOleAllocate@4

It is a huge project, with lots of dependent projects - that I have added in the solution, and they all build properly.
I have performed a search in the entire solution for the above entities, like 'CStdStubBuffer2' with no result. I did find them in the MyProject_p.obj among other impossible to read items but I don't know what to do about that. I looked at similar questions but could not find anything that could help me. Could someone tell me where I can look at to troubleshoot this problem ? Thank you.

like image 820
Thalia Avatar asked Dec 13 '22 03:12

Thalia


2 Answers

From IUnknown_Release_Proxy reference, you need to link with RpcRT4.lib (the other functions listed are also defined in the same lib).

like image 61
hmjd Avatar answered May 20 '23 00:05

hmjd


CStdStubBuffer2_Release gets created by other code generated by the MIDL compiler. Using command line options like "/dlldata MyProject_d.c" you'll get an additional file generated that needs to be compiled and linked with the rest of the project.

That file will contain, among other things, a line like "DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )". Definitions from RpcProxy.h mean that this gets expanded and creates the CStdStubBuffer2_Release function (which is implemented using the NdrCStdStubBuffer2_Release function mentioned by @hmjd).

like image 23
Andrew Avatar answered May 20 '23 02:05

Andrew