【发布时间】:2017-10-04 09:47:05
【问题描述】:
我收到此错误:
CMakeFiles/Athena.dir/Startup/main.cpp.o: In function `CryptoPP::ClonableImpl<CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)0, CryptoPP::Rijndael::Enc>, CryptoPP::Rijndael::Enc>::ClonableImpl()':
/home/dev/workspace/Athena/lib/cryptopp/simple.h:26: undefined reference to `CryptoPP::Rijndael::Enc::Enc()'
collect2: error: ld returned 1 exit status
CMakeFiles/Athena.dir/build.make:434: recipe for target 'Athena'
当我尝试将 CryptoPP 链接到我的程序时。
这是我的 CMakeLists.txt:
cmake_minimum_required(VERSION 3.8)
project(Athena)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fpermissive -Wno-deprecated -Wno-int-to-pointer-cast -Wno-deprecated-declarations")
include_directories(lib/SQLiteCpp/include)
add_subdirectory(lib/SQLiteCpp)
include_directories(lib/cryptopp)
add_subdirectory(lib/cryptopp)
include_directories(lib/json/src)
add_subdirectory(lib/json)
set(SOURCE_FILES
Startup/main.cpp)
add_executable(Athena ${SOURCE_FILES})
target_link_libraries(Athena SQLiteCpp sqlite3 pthread dl cryptopp)
这是我的内容:
#include "modes.h" // For CTR_Mode
#include "filters.h" //For StringSource
#include "aes.h" // For AES
我已经尝试通过 find_package、find_library 链接cryptopp,甚至尝试编写脚本来手动下载和制作cryptopp。我真的没有想法,我也很确定这不是我的代码(我粘贴了来自 cryptopp wiki 的示例)。
【问题讨论】:
-
我们围绕
Rijndael::Enc构造函数重新编写了代码。 ctor 不再存在于 Rijndael 类中。现在将使用默认的、编译器生成的 ctor。您需要从 Master 那里获取最新的资源。另请参阅Commit 01e46aa474f6。