- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
不久前,我开始在 Visual Studio 2015 中编写我的应用程序,在设置所有库依赖项时没有遇到任何问题。
现在,我决定转向 CLion。但是,我的应用程序依赖于 cryptopp
库,我需要将其链接到我的 CLion 项目中。
目前,我面临着大量的undefined reference
错误
undefined reference to `CryptoPP::Integer::Integer(char const*)'
undefined reference to `CryptoPP::Integer::Integer(char const*)'
undefined reference to `CryptoPP::Integer::Integer(char const*)'
undefined reference to `CryptoPP::DH_Domain<CryptoPP::DL_GroupParameters_GFP_DefaultSafePrime, CryptoPP::EnumToType<CryptoPP::CofactorMultiplicationOption, 0> >::AccessGroupParameters()'
undefined reference to `CryptoPP::DH_Domain<CryptoPP::DL_GroupParameters_GFP_DefaultSafePrime, CryptoPP::EnumToType<CryptoPP::CofactorMultiplicationOption, 0> >::GetGroupParameters() const'
undefined reference to `CryptoPP::DH_Domain<CryptoPP::DL_GroupParameters_GFP_DefaultSafePrime, CryptoPP::EnumToType<CryptoPP::CofactorMultiplicationOption, 0> >::GetGroupParameters() const'
[..]
我确实在我的 CMakeLists 中设置了包含目录:
set(EXTERN_LIBS E:/dev/libs)
include_directories(${EXTERN_LIBS} ${EXTERN_LIBS}/include)
link_directories(${EXTERN_LIBS})
但是,我仍然无法让它工作。
我正在为我的项目使用 MinGW。以下是设置和版本的预览:
如何将 cryptopp
库正确添加到我在 CLion 中的项目中?
最佳答案
我认为我们可能已经在 Commit e4cef84883b2 解决了大部分 MinGW/C++11 问题.您应该从 Master 开始工作或执行 git pull
,然后在 config.h
: 65 中取消注释 CRYPTOPP_NO_CXX11
的定义| (左右):
// 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
,则将不定义以下内容,您将避免这些问题:CRYPTOPP_CXX11_DYNAMIC_INIT
、CRYPTOPP_CXX11_SYNCHRONIZATION
和 CRYPTOPP_CXX11_ATOMICS
。
第二个问题,关于Clion和Cmake的问题,解决如下。我们使用我们的 Autotools 和 Cmake 文件设置了一个单独的 GitHub。 Autotools 文件位于 cryptopp-autotools , Cmake 文件位于 cryptopp-cmake .
存储库在我的 GiHub 中,因为编写该库并提供 Crypto++ GitHub 的戴伟希望避免这种管理方式。逻辑分离还有助于建立逻辑边界,让人们知道 Autotools 和 CMake 不是官方 Crypto++ 发行版的一部分。
社区负责 Autotools 和 Cmake,我们将与社区一起解决问题。如果社区投入工作,那么 Autotools 和 Cmake 将会改进。如果 Autotools 或 CMake 变得稳定,那么我们会将包含这些文件的 tarball 添加到官方发行版中。
目前Autotools和Cmake都处于需要改进的状态。 Cmake 的问题详见 CMake | Current Status在维基上。 Autotools 的问题并没有真正记录下来,因为我与发行版维护人员一起工作。这有点像我们知道问题是什么,但大多数其他人不知道。
关于c++ - CLion 和 Crypto++ 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46989046/
如何在 Mac 上的 Clion EAP 中更改默认工作目录? 每次创建新项目时,我都需要将其更改为项目位置。 最佳答案 首先,无法通过 CLion 的 GUI 更改工作目录(请参阅 Source 中
我想知道 CLion IDE 是用什么语言编写的,以及使用什么库来制作图形。 最佳答案 See this wiki post. 用Java编写 关于clion - CLion 是用什么语言和图形库制作
我已按照说明更新我的 GDB 以便与 Eigen3 一起使用。但是,CLion IDE 无法在调试面板中加载特征矩阵的内容。 本应是快速验证和调试结果的过程变成了耗时的手动打印过程(或更糟:在 cyg
我正在尝试使用 Clion 编写一个 C++ 应用程序,该应用程序使用使用 ASCII 序列的彩色控制台输出。当我在 Clion 中运行程序时,没有显示颜色。但是当我在终端中运行程序时,我可以看到颜色
使用CLion时,我发现输出有时会中断。 例如,在运行代码时: main.cpp #include int main() { int i; for (i = 0; i < 1000;
我正在寻找一种在 CLion IDE 中并行处理多个项目的方法。 现在我一次只能处理一个窗口中的每个项目,但我正在寻找类似于 Eclipse IDE(见下文)的解决方案 - 能够在侧栏上看到我不同项目
嗨,我在更改函数颜色的颜色时遇到问题。我正在使用 Material 主题,除了函数调用之外,我更改了几乎所有颜色。任何人都遇到过这个问题并知道如何解决它?它是否列在另一个标题下?我目前将它用于 C/C
大多数从可以选择构建单个文件的其他 IDE 切换过来的人都对 CLion 感到有些困惑,而 CLion 恰好没有选项。 那么如何避免将每个源文件的每个名称都添加到 CMake 中呢? 最佳答案 您正在
在 CLion 中,如何指定 C++ 编译器将在其中查找头文件的包含目录?另外,如何设置要链接的库及其库目录? 目前我正在做那些直接修改文件的任务 CMakeLists.txt : include_d
在使用 CLion 时,我发现输出有时会中断。 例如运行代码时: main.cpp #include int main() { int i; for (i = 0; i < 1000
在查看 C 库函数或系统调用的文档时,Linux 上的 CLion 会显示相应的手册页。我在 Windows 本地和适用于 Linux 的 Windows 子系统中都安装了手册和手册页。有没有办法将
在 CLion 中创建文件时,以下标题位于文件顶部: // // Created by on 14.01.18. // 有人通过 can remove this header 去 Settings
我想要查看我的 C 程序的 ASM 有很多原因,但据我发现,似乎只能查看没有 src 的 3rd 方模块的 ASM。 如何查看我的 src 的 ASM? 最佳答案 我有同样的问题,但找到了 clion
我很难让 Ctrl+V 在 CLion 中粘贴代码(我使用的是 Windows 1.1.1 版)。当我尝试粘贴使用 Ctrl+C 复制的代码时,例如网站或其他程序,它似乎只是偶尔工作。通常它会粘贴一段
CLion 有一个很好的 integration of Clang-Tidy ,但默认配置是针对现代 C++ 的。然而,我坚持使用的编译器仅为 C++03,而且 Clang-Tidy 关于使我的代码现
我正在尝试在我的 Windows 机器中将 valgrind 与 clion 结合使用。我已经完成了 setting up WSL 的步骤和 valgrind在 window 上。虽然当我尝试在我的“
使用上下文菜单,我可以通过右键单击和 new > C++ Class 在 CLion 中轻松创建 .cpp 和头文件. 头文件的扩展名为.h。如何使 .hpp 成为默认的 header 扩展? 最佳答
编译前准备 我们正常直接编译后生成的exe是没有任何图标的 那么很多exe程序都是有个性图标的那么在vs和qt中是比较简单的可是在Clion编译中怎么才能添加呢? 前提条件,本机必须配置好MinGW,
虽然在我的编程“职业”中大部分时间都使用了 Java 和 PHP,但我现在正在尝试更深入地学习 C++。为此,我使用 CLion 作为我的 IDE - 主要是因为我非常熟悉 phpStorm 和 In
您好,我用 c 语言编程,我喜欢使用 clion。有没有办法更改它在新项目中创建的默认文件的方式?我希望它创建一个 main.c 和 make 文件来反射(reflect)这一点。 最佳答案 阅读Ho
我是一名优秀的程序员,十分优秀!