0
votes

I get the following error when upgrading a c++ application from Visual Studio 2010 to 2013.

error LNK2019: unresolved external symbol __imp__SysAllocStringByteLen@8 referenced in function "wchar_t * __stdcall CtVbErrorMessage(unsigned long)" (?CtVbErrorMessage@@YGPA_WK@Z)

fatal error LNK1120: 1 unresolved externals

I started getting this error when I changed the Use of MFC option from Use standard windows libraries to Use MFC in a shared DLL.

This is the area of code where the error occurs.

_DLL_EXPORT_ ( BSTR, CtVbErrorMessage (CtErrorHandle hErr) )

{
   BSTR     vbstr   = SysAllocStringByteLen("", 0);
   char*        str;
   CEsoError*   p_err   = (CEsoError*)hErr;

   if (p_err)
   {
      str = (char*)p_err->GetFullMessage();

      if (str)
        vbstr = SysAllocStringByteLen(str, strlen(str));
   }

   return vbstr;
}
1

1 Answers

0
votes

Seems your project now needs to link with other libraries. Specifically, OleAut32.lib