sun*_*set 4 c++ ubuntu openssl
我在我的代码中使用了crypto ++.我不想使用它的依赖项,所以我试图在我的文件夹中导入crypto ++文件并将它们包含在我的.cpp文件中
我有以下错误:
TEST.cpp:(.text+0x89a0): undefined reference to `EVP_CIPHER_CTX_init'
TEST.cpp:(.text+0x8cb0): undefined reference to `EVP_aes_128_cbc'
TEST.cpp:(.text+0x8cdd): undefined reference to `EVP_CipherInit_ex'
TEST.cpp:(.text+0x8d49): undefined reference to `EVP_CipherUpdate'
TEST.cpp:(.text+0x8dd6): undefined reference to `EVP_CipherFinal_ex'
TEST.cpp:(.text+0x922d): undefined reference to `EVP_CIPHER_CTX_cleanup'
Run Code Online (Sandbox Code Playgroud)
我错过了什么?需要一些帮助.欣赏!我在ubuntu工作.
你需要做两件事,到目前为止你只完成了一件事.
您需要告诉编译器在哪里找到适当的声明.你已经通过添加来做到这一点
#include "evp.h"
Run Code Online (Sandbox Code Playgroud)
在您的源文件中.(根据你安装crypto ++的方式,你可能还需要告诉编译器在哪里找到"evp.h",可能还在使用-Isome_directory.)
您缺少的步骤是告诉链接器在哪里可以找到您正在使用的函数的实际实现(已编译的代码).根据Readme.txt发行版中包含的文件,bulding crypto ++创建一个名为的库文件libcryptopp.a.
所以这样的事情应该做的工作:
gcc my_program.c -o my_program -lcryptopp
Run Code Online (Sandbox Code Playgroud)
根据您安装它的方式和位置,您可能还需要指定-Lsome_directory告诉链接器在哪里找到它libcryptopp.a.(该gcc命令调用编译器和链接器.该-l选项告诉链接器使用libcryptopp.a.-L如果需要,该选项告诉它要查看的目录.)
| 归档时间: |
|
| 查看次数: |
10505 次 |
| 最近记录: |