c – How to use OpenSSL in GCC?

I am trying to use openssl in a gcc program, but it does not work properly.

g++ server.cpp /usr /lib/libssl.a -o server

gives an error message, just like the -l option. What must I type on the command line to link with openssl? The file /usr/lib/libssl.a exists, but I still get the linker error No such function MD5() exists.

< div class="answer"> Without knowing the exact error you are seeing, it is difficult to provide an accurate solution. This is my best attempt.

According to what you provide It sounds like the linker failed because it can’t find a reference to the md5 function in libssl.a. I believe this function is actually in libcrypto, so you may also need to specify this library.

< p>g server.cpp -L /usr/lib -lssl -lcrypto -o server

I am trying to use openssl in a gcc program, but it does not work.

g++ server.cpp /usr/lib/libssl.a -o server

gives an error message, just like the -l option .What do I have to type on the command line to link with openssl? The file /usr/lib/libssl.a exists, but I still get the linker error. No such function MD5() exists.

In the case of the exact error seen, it is difficult to provide an accurate solution. This is my best attempt.

Based on the information you provided, it sounds like the linker failed because it Cannot find a reference to the md5 function in libssl.a. I believe this function is actually in libcrypto, so you may also need to specify this library.

g server.cpp -L /usr/lib -lssl -lcrypto -o server

Leave a Comment

Your email address will not be published.