How to compile .c file with OpenSSL includes?
Your include paths indicate that you should be compiling against the system's OpenSSL installation. You shouldn't have the .h
files in your package directory - it should be picking them up from /usr/include/openssl
.
The plain OpenSSL package (libssl
) doesn't include the .h
files - you need to install the development package as well. This is named libssl-dev
on Debian, Ubuntu and similar distributions, and libssl-devel
on CentOS, Fedora, Red Hat and similar.
Use the -I
flag to gcc properly.
gcc -I/path/to/openssl/ -o Opentest -lcrypto Opentest.c
The -I
should point to the directory containing the openssl
folder.
Use the snippet below as a solution for the cited challenge;
yum install opensslyum install openssl-devel
Tested and proved effective on CentOS version 5.4 with keepalived version 1.2.7.