1

I am new to Openssl. I have openssl 1.1.0e and libssl-dev installed on ubuntu 16.04. I am trying to run the example on this page in openssl documentation https://www.openssl.org/docs/man1.1.0/crypto/EVP_DigestInit.html.

I use the command

gcc example1.c -lssl -lcrypto 

to compile the program. But I get the following error Undefined Reference error

I have seen related questions on the forum but cannot find the solution. If anyone can help with pointing out the solution, it will be a great help.

jww
  • 97,681
  • 90
  • 411
  • 885
sangat
  • 11
  • 5
  • post your code in text here. don't use links to images that contain text. – bruceg Apr 26 '17 at 21:50
  • Btw, I have compiled openssl code with exactly the gcc flags you used. – bruceg Apr 26 '17 at 22:22
  • Ubuntu ships with OpenSSL 1.0.2 (or maybe 1.0.1); not OpenSSL 1.1.0. You need to use `-L`, too. `-L` tells the linker where to find the libraries. You might find it easier to use Ubuntu's OpenSSL since everything will be on-path. Also see [How do I install the OpenSSL libraries on Ubuntu?](http://stackoverflow.com/q/3016956/608639) – jww Apr 26 '17 at 23:28
  • @jww thanks for comment it worked after using the default OpenSSL 1.0.0 – sangat Apr 27 '17 at 14:34
  • post the actual code YOU are using, post the actual error messages your compiler is outputing. DO NOT post links to that information. – user3629249 Apr 27 '17 at 21:06
  • Note: when compiling with `gcc`, at a minimum use the following parameters to enable the warnings, then fix those warnings. `-Wall -Wextra -pedantic` I also use: `-Wconversion -std=gnu11 ) – user3629249 Apr 27 '17 at 21:08

0 Answers0