views:

431

answers:

1

I'm tring to use openssl in a gcc program but it isn't working.

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

gives error, anything with -l option gives error, what should I type on command line to use openssl. The file /usr/lib/libssl.a exists, but still linker error no such funtion MD5() exists occurs.

A: 

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

jschmier