How to compile .c file with OpenSSL includes?

前端 未结 7 927
醉梦人生
醉梦人生 2020-11-27 03:40

I am trying to compile a small .c file that has the following includes:

#include 
#include 
#include 

        
7条回答
  •  囚心锁ツ
    2020-11-27 04:11

    From the openssl.pc file

    prefix=/usr
    exec_prefix=${prefix}
    libdir=${exec_prefix}/lib
    includedir=${prefix}/include
    
    Name: OpenSSL
    Description: Secure Sockets Layer and cryptography libraries and tools
    Version: 0.9.8g
    Requires:
    Libs: -L${libdir} -lssl -lcrypto
    Libs.private: -ldl -Wl,-Bsymbolic-functions -lz
    Cflags: -I${includedir}
    

    You can note the Include directory path and the Libs path from this. Now your prefix for the include files is /home/username/Programming . Hence your include file option should be -I//home/username/Programming.

    (Yes i got it from the comments above)

    This is just to remove logs regarding the headers. You may as well provide -L option for linking with the -lcrypto library.

提交回复
热议问题