【问题标题】:Linker error while upgrading a C++ application from Visual Studio 2010 to 2013.将 C++ 应用程序从 Visual Studio 2010 升级到 2013 时出现链接器错误。
【发布时间】:2014-03-05 23:11:28
【问题描述】:

将 c++ 应用程序从 Visual Studio 2010 升级到 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

当我将使用 MFC 选项从使用标准 Windows 库更改为在共享 DLL 中使用 MFC 时,我开始收到此错误。

这是发生错误的代码区域。

_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;
}

【问题讨论】:

    标签: visual-studio-2013 static-libraries linker-errors


    【解决方案1】:

    看来您的项目现在需要与其他库链接。具体来说,OleAut32.lib

    【讨论】:

      猜你喜欢
      • 2014-10-17
      • 2013-01-17
      • 1970-01-01
      • 1970-01-01
      • 2014-03-20
      • 2011-03-06
      • 1970-01-01
      • 2018-01-10
      • 2013-10-26
      相关资源
      最近更新 更多