I am implementing a OpenSSL code and have already included required header files but still I am getting errors like *
undefined reference to
SSL_library_init
I guess it's a linking error rather than a compilation error.
I am implementing it in Linux box using slickeditor.
-lcrypto
for gcc? – Virescent-lcrypto
. – VirescentSSL_library_init
is in libssl, so the link option would be-lssl
.ldd $(which openssl)
will show you how your openssl is linked and where those libraries are. If it still doesn't work, perhaps that directory is not on the path for the linker. You can add that path with-Lpath
, such as-L/lib/
– Virescent-L/lib/ -lssl
(in that order). – Virescent#include "whatever" \n int main(void) { SSL_library_init(blah, blah, blah); return 0; }
and theng++ my_minimal_test_case.c++ -lssl
. If this works then you don't understand your editor/IDE. If it doesn't then you have some configuration issue. – Virescent