我认为我们可能已经基本解决了 MinGW/C++11 问题提交 e4cef84883b2 https://github.com/weidai11/cryptopp/commit/e4cef84883b2。你应该跟随师父工作或者执行git pull
,然后取消注释定义CRYPTOPP_NO_CXX11
in config.h : 65 https://github.com/weidai11/cryptopp/blob/master/config.h#L57(或者):
// Define CRYPTOPP_NO_CXX11 to avoid C++11 related features shown at the
// end of this file. Some compilers and standard C++ headers advertise C++11
// but they are really just C++03 with some additional C++11 headers and
// non-conforming classes. You might also consider `-std=c++03` or
// `-std=gnu++03`, but they are required options when building the library
// and all programs. CRYPTOPP_NO_CXX11 is probably easier to manage but it may
// cause -Wterminate warnings under GCC. MSVC++ has a similar warning.
// Also see https://github.com/weidai11/cryptopp/issues/529
// #define CRYPTOPP_NO_CXX11 1
我认为问题是,您遇到了与 Windows 及其缺乏适当的 C++11 支持相关的问题,但您是间接得到这些问题的。它们是间接的,因为 MinGW 和 GCC 位于顶层。 MinGW 和 GCC 不可能提供 C++11,因为底层平台不能。
我认为此时你最好的选择是定义CRYPTOPP_NO_CXX11
。我不相信我们可以像在 Windows 上那样为您做到这一点,因为我们需要访问的定义隐藏在 MinGW 和 GCC 后面。我们还有一些 MSVC++ 错误需要解决。
这是我们在 Windows 上执行此操作的方法,但我们无法访问 MinGW 中的这些定义(来自config.h
: 950):
// Dynamic Initialization and Destruction with Concurrency ("Magic Statics")
// MS at VS2015 with Vista (19.00); GCC at 4.3; LLVM Clang at 2.9; Apple Clang at 4.0; Intel 11.1; SunCC 5.13.
// Microsoft's implementation only works for Vista and above, so its further
// limited. http://connect.microsoft.com/VisualStudio/feedback/details/1789709
#if (CRYPTOPP_MSC_VERSION >= 1900) && ((WINVER >= 0x0600) || (_WIN32_WINNT >= 0x0600)) || \
(CRYPTOPP_LLVM_CLANG_VERSION >= 20900) || (CRYPTOPP_APPLE_CLANG_VERSION >= 40000) || \
(__INTEL_COMPILER >= 1110) || (CRYPTOPP_GCC_VERSION >= 40300) || (__SUNPRO_CC >= 0x5130)
# define CRYPTOPP_CXX11_DYNAMIC_INIT 1
#endif // Dynamic Initialization compilers
如果你定义CRYPTOPP_NO_CXX11
,那么下面将not被定义,你将避免以下问题:CRYPTOPP_CXX11_DYNAMIC_INIT
, CRYPTOPP_CXX11_SYNCHRONIZATION
, and CRYPTOPP_CXX11_ATOMICS
.
第二个问题与 Clion 和 Cmake 相关,解决如下。我们使用 Autotools 和 Cmake 文件设置了一个单独的 GitHub。 Autotools 文件位于cryptopp-自动工具 https://github.com/noloader/cryptopp-autotools,Cmake 文件位于cryptopp-cmake https://github.com/noloader/cryptopp-cmake.
这些存储库位于我的 GiHub 中,因为这是编写该库并提供 Crypto++ GitHub 的 Wei Dai 更愿意避免的管理方式。逻辑分离还有助于建立逻辑边界,以便人们知道 Autotools 和 CMake 不是官方 Crypto++ 发行版的一部分。
社区负责 Autotools 和 Cmake,我们将与社区合作解决问题。如果社区投入工作,那么 Autotools 和 Cmake 将会得到改进。如果 Autotools 或 CMake 变得稳定,那么我们将向官方发行版添加包含文件的 tarball。
目前Autotools和Cmake处于需要改进的状态。 Cmake 的问题详述于CMake |当前状态 https://www.cryptopp.com/wiki/CMake#Current_Status在维基上。 Autotools 的问题并没有真正记录下来,因为我与发行版维护人员一起处理它们。这有点像我们知道问题是什么,但大多数其他人不知道。