How to use OpenSSL with GCC?

前端 未结 5 1786
闹比i
闹比i 2020-11-29 06:47

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 d

5条回答
  •  死守一世寂寞
    2020-11-29 07:23

    On top of the accepted answers, I could not make compile the OpenSSL example for AES-CCM:

    https://github.com/openssl/openssl/blob/master/demos/evp/aesccm.c

    To make it work I needed to add two more things:

    • The Dinamic Linking Library : -ldl
    • The PThread library to use POSIX threading support: -pthread (Adding directly the library with -lpthread is not recommended )

提交回复
热议问题