Communication error: undefined reference to EVP_CIPHER_CTX_ and EVP_CIPHER_CTX_init

I am using crypto ++ in my code. I do not want to use its dependencies, so I tried to import crypto ++ files into my folder and include them in my .cpp file

I have followng errors:

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' 

What am I missing? need help. Appreciate! I work in ubuntu.

+4
source share
2 answers

You need to do two things from which you just made it.

You must tell your compiler where to find the relevant declarations. You did it by adding

 #include "evp.h" 

in the source file. (Depending on how you installed crypto ++, you may also need to tell the compiler where to find "evp.h" , possibly using -Isome_directory .)

If you were missing, you need to tell the linker where to find the actual implementation (compiled code) of the functions you use. According to the Readme.txt file included in the distribution, bulding crypto ++ creates a library file called libcryptopp.a .

So, something like this should complete this task:

 gcc my_program.c -o my_program -lcryptopp 

Depending on how and where you installed it, you may also need to specify -Lsome_directory to tell the linker where to find libcryptopp.a . (The gcc command invokes both the compiler and the linker. The -l option tells the linker to use libcryptopp.a . The -l option, if necessary, tells it which directory to look for.)

+4
source
 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' 

This is not Crypto ++ - its OpenSSL.


If you need to install Crypto ++ on Ubuntu, then:

 root@bruno :/# apt-cache pkgnames | grep -i crypto++ libcrypto++-utils libcrypto++8 libcrypto++8-dbg libcrypto++-dev libcrypto++-doc root@bruno :/# apt-get install libcrypto++8 libcrypto++8-dbg libcrypto++-dev Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: libcrypto++-dev libcrypto++8 libcrypto++8-dbg 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 10.7MB of archives. ... 
+2
source

All Articles