Question:
How to compile a C program that uses openSSL library?
Laguna Rock
2011-07-12 04:08:54 UTC
Operating system: Ubuntu

when I compile the program, it doesn't work because it can't find the library files
For example:
# include

I am compiling this way:
gcc -lopenssl filename.c

and I don't know if it is right... on the Internet there are a lot of ways but I can't find the right one.
I also tried to search for the file (for example des.h) but I didn't find it.
I wonder if the installation has gone well. But typing "openssl version" on the command line I get it's actually installed, otherwise he wouldn't say anything. I also checked the package manager and it's ok.
So why are the libraries missing? Perhaps is the compiling process wrong? or both?
Anyway:
how to include the OpenSSL libraries?
how to compile a C program that it should use them?
Do I have to install openssl in any particular way?
Three answers:
ratter_of_the_shire
2011-07-12 04:37:20 UTC
a shot in the dark here..



ar the dev libraries fo ssh installed?



otherwise I think you also need a configure a make file to tell gcc where the library is at.
?
2011-07-12 04:46:10 UTC
I have a similar problem - yet to be solved... I would like to do EAP-TLS authentication with pppd, for which a patch is needed: http://eaptls.spe.net/download/ppp-2.4. … 0.7.patch. I've already had success with this patch on Fedora and Ubuntu, works like a charm. (There's one more thing: the ssl.h in newer OpenSSL versions must also be patched like this:)

Code:

diff -urN old-openssl-0.9.8e/ssl/ssl.h openssl-0.9.8e/ssl/ssl.h

--- old-openssl-0.9.8e/ssl/ssl.h 2007-02-19 18:55:07.000000000 +0100

+++ openssl-0.9.8e/ssl/ssl.h 2008-05-12 12:06:05.000000000 +0200

@@ -191,6 +191,7 @@

#include

#include

#include

+#include



#ifdef __cplusplus

extern "C" {



Patching OpenSSL works fine, at least compiling doesn't end there (and without the pppd patch everything compiles
watkin
2016-11-15 02:41:30 UTC
Strictly conversing C++ is a superset of C . . . that is to declare, any valid C software is likewise a valid C++ software, even however maximum C++ code looks incredibly diverse from C code. in simple terms use your C++ compiler to hold collectively it and you'd be high quality.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...