【问题标题】:Build error with "___report_rangecheckfailure" with OpenSSL libs使用 OpenSSL 库生成“___report_rangecheckfailure”错误
【发布时间】:2016-01-04 11:17:37
【问题描述】:

使用 VC++ 2010

使用 OpenSSL 库进行编译以生成 SHA512 哈希...

收到此构建错误:

1>------ Build started: Project: Second, Configuration: Debug Win32 ------
1>  stdafx.cpp
1>  AssemblyInfo.cpp
1>Second.cpp
1>  Second.cpp(64): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\stdio.h(371) : see declaration of 'sprintf'
1>  Generating Code...
1>  .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1>  Microsoft (R) Incremental Linker Version 10.00.40219.01
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1>  
1>  "/OUT:C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.exe" /INCREMENTAL "C:\Program Files\OpenSSL-Win32\lib\VC\static\ssleay32MD.lib" "C:\Program Files\OpenSSL-Win32\lib\VC\static\libeay32MD.lib" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /ASSEMBLYRESOURCE:Debug\Second.Form1.resources /MANIFEST "/ManifestFile:Debug\Second.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /DEBUG "/PDB:C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.pdb" /ASSEMBLYDEBUG /SUBSYSTEM:WINDOWS /TLBID:1 "/ENTRY:main" /DYNAMICBASE /FIXED:NO /NXCOMPAT /MACHINE:X86 Debug\app.res 
1>  Debug\AssemblyInfo.obj 
1>  Debug\Second.obj 
1>  Debug\stdafx.obj 
1>  "Debug\.NETFramework,Version=v4.0.AssemblyAttributes.obj" 
1>libeay32MD.lib(obj_dat.obj) : error LNK2019: unresolved external symbol ___report_rangecheckfailure referenced in function _OBJ_create_objects
1>libeay32MD.lib(b_print.obj) : error LNK2001: unresolved external symbol ___report_rangecheckfailure
1>C:\Users\Boss\documents\visual studio 2010\Projects\Second\Debug\Second.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

尝试禁用缓冲区溢出安全检查,同样的错误..

有什么想法吗?用 Crypto++ 尝试了一整天,无济于事,OpenSSL 更容易,只是挂断了这个错误......

【问题讨论】:

    标签: c++ visual-studio-2010 openssl sha


    【解决方案1】:

    您似乎正在尝试链接到使用更高版本的编译器构建的 OpenSSL 库。

    函数 ___report_rangecheckfailure 是在 Visual Studio 的较新版本中引入的(有关详细信息,请参阅 http://blogs.microsoft.com/cybertrust/2012/01/26/enhancements-to-gs-in-visual-studio-11/)。

    所以链接器正在 VS2010 库中查找一个直到后来才存在的函数。

    至少一个为 Windows 预构建的 OpenSSL 库的维护者最近已不再使用 Visual Studio 的早期版本,这可能会触发您的问题。

    一种解决方案是使用 VS2010 构建您自己的 OpenSSL Windows 二进制文件(例如,参见 http://developer.covenanteyes.com/building-openssl-for-visual-studio/)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-12
      • 1970-01-01
      • 2011-01-16
      • 2019-08-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多