这是我的一部分
CMakeLists.txt
.
find_package(OpenSSL REQUIRED)
add_executable(
aes_test
src/aes_test.cpp
)
MESSAGE(${OPENSSL_FOUND})
MESSAGE(${OPENSSL_SSL_LIBRARY})
target_link_libraries(
aes_test
${OPENSSL_SSL_LIBRARY}
)
这个
MESSAGE
的输出
TRUE
/usr/local/opt/openssl/lib/libssl.dylib
cmake
找到了
OpenSSL
但是,当我将程序aes_测试与
OpenSSL
存在链接错误。
Undefined symbols for architecture x86_64:
"_AES_decrypt", referenced from:
_main in aes_test.cpp.o
"_AES_encrypt", referenced from:
_main in aes_test.cpp.o
"_AES_set_decrypt_key", referenced from:
_main in aes_test.cpp.o
"_AES_set_encrypt_key", referenced from:
_main in aes_test.cpp.o
ld: symbol(s) not found for architecture x86_64
在
aes_test.cpp
,我使用函数
AES_set_encrypt_key
其定义见
aes.h
. 怎么了?有人能帮我吗?事先谢谢。