简体   繁体   中英

including external library to C

I am trying to include

#include <openssl/evp.h>

to my C program.

I have downloaded openssl from their site and extracted folder

  -openssl
    - evp.h

however using compilation command

g++ -Wall -pedantic program.c -lopenssl/evp

threw same error

fatal error: evp.h: No such file or directory
 #include <openssl/evp.h>

I have tried to just include #include

and copy evp.h directly to the folder with my program.c and compile it using

g++ -Wall -pedantic program.c -evp

yet it still throws same error. What is the right way to include this kind of library into my C program?

Thanks!.

You write that you downloaded opensll, but not that you compiled and nstalled it. If you didn't the header file you try to include is not in a place where the compiler would look for it. And even if you somehow manage to include the header file (eg by copying it to a place where the compiler finds it or modifying its search path) the next step in building your program, linking it, will rather likely fail if the library itself isn't anywhere to be found (the header file just contains a description of the libraries interface and isn't the library!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM