如何编译.c文件与OpenSSL的包括? [英] How to compile .c file with OpenSSL includes?
问题描述
我试图编译具有以下的小.c文件包括:
I am trying to compile a small .c file that has the following includes:
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#include <openssl/x509.h>
#include <openssl/evp.h>
在那里我有.c文件我有一个/ OpenSSL的所有这些文件(及以上),也是在新立得软件包管理器我看到安装了OpenSSL相同的文件夹,我想这个编译:
In the same folder where i have the .c file I have a /openssl with all those files (and more), also in synaptic package manager I see OpenSSL installed, I am trying to compile with this:
gcc -o Opentest Opentest.c -lcrypto
但我总是得到错误:
but I always get the errors:
error: openssl/ssl.h: No such file or directory
error: openssl/rsa.h: No such file or directory
error: openssl/x509.h: No such file or directory
error: openssl/evp.h: No such file or directory
文件我想要编译只是一个.c文件,可是没有Makefile文件或的./configure。
The file I want to compile is only a .c file, doesnt have Makefile or ./configure.
我已经尝试过:
env CFLAGS=-I/path/to/openssl/
,并试图重新编译,但我得到了同样的错误。
and tried to compile again but i get the same errors.
我应该以编译OpenSSL的做包括?
What should I do in order to compile with openssl includes?
推荐答案
您include路径表明您应该编译反对的系统的OpenSSL的安装。你不应该有 .H
文件在你的包目录 - 它应该从来接他们的/ usr / include中/ OpenSSL的
。
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
.
平原OpenSSL软件包(的libssl
)不包括 .H
文件 - 你需要安装开发包以及(的libssl-dev的
)。
The plain OpenSSL package (libssl
) doesn't include the .h
files - you need to install the development package as well (libssl-dev
).
这篇关于如何编译.c文件与OpenSSL的包括?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!