I'm trying to use openssl in a gcc program but it isn't working.
g++ server.cpp /usr/lib/libssl.a -o server
gives an error message, as does anything with the -l
option. What must I type on the command line to link with openssl? The file /usr/lib/libssl.a
exists, but nevertheless I still get the linker error no such function MD5() exists
.
The standard location of the development libs is /usr/include/openssl . The only shared objects for openssl are in /usr/lib/i386-linux-gnu/openssl-1.0. 0/engines/ .
The openssl library is a C library and if VS is not able to compile C code.
Without knowing the exact errors you are seeing, it is difficult to provide an exact solution. Here is my best attempt.
From the information you provided, it sounds as though the linker is failing because it cannot find a reference to the md5
function in libssl.a
. I believe this function is actually in libcrypto
so you may need to specify this library as well.
g++ server.cpp -L/usr/lib -lssl -lcrypto -o server
You or others may find this article developerWorks article helpful.
It describes most things you need to know to get off the ground with OpenSSL and C/C++. If you find you are following most of the same steps, it might help you see what needs doing.
Good luck.
update
Note: keeping both links because they be used to find new discoveries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With