0

我正在尝试使用最新版本的 OpenSSL (v1.1.1k) 编译我的 Visual Studio WIN32 项目,但我遇到以下关于 refcount.h 的编译器错误。在 refcount.h 中,编译器抱怨使用 InterlockedExchangeAdd() 函数从 volatile int* 到 volatile long* 的非法转换,该函数位于第三个 else if 预处理器指令块中,其中 #elif defined(_MSC_VER) && _MSC_VER>= 1200。除了注释掉 else if 块以使用正确的逻辑强制它进入 else 块之外,我尝试使用各种 Visual Studio 设置以及 OpenSSL 选项,但没有成功。我想知道是否有人遇到过同样的问题,或者是否有办法在不修改文件的情况下解决问题。

1>C:\openssl\openssl-1.1.1k\include\internal\refcount.h(116,42): 错误 C2664: 'long _InterlockedExchangeAdd(volatile long *,long)': 无法从 'volatile int * 转换参数 1 ' to 'volatile long *' 1>C:\openssl\openssl-1.1.1k\include\internal\refcount.h(116,36): message : 指向的类型不相关;转换需要 reinterpret_cast、C 样式转换或函数样式转换 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\intrin0.h(189, 1): 消息:见 '_InterlockedExchangeAdd' 1>C:\openssl\openssl-1.1.1k\include\internal\refcount.h(122,43) 的声明:错误 C2664: 'long _InterlockedExchangeAdd(volatile long *,long) ': 无法将参数 1 从 'volatile int *' 转换为 'volatile long *' 1>C:\openssl\openssl-1.1。1k\include\internal\refcount.h(122,36): message : 指向的类型不相关;转换需要 reinterpret_cast、C 样式转换或函数样式转换 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\intrin0.h(189, 1): 消息:见 '_InterlockedExchangeAdd' 的声明

额外的信息:

Visual Studio Community 2019,Windows SDK 版本:10.0,平台工具集 v142

使用以下选项构建的 OpenSSL 1.1.1k: perl 配置 VC-WIN32 --debug no-engine

4

0 回答 0