C:编译openSSL项目
我正在尝试用openssl编写一些c代码 假设我有一个使用openssl的文件C:编译openSSL项目,c,makefile,C,Makefile,我正在尝试用openssl编写一些c代码 假设我有一个使用openssl的文件hello.c hello.c ... #include <openssl/rand.h> #include <openssl/ssl.h> #include <openssl/err.h> ... 运行makefile时,出现以下错误: hello.c:4:26: fatal error: openssl/rand.h no such file or directory #in
hello.c
hello.c
...
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
...
运行makefile时,出现以下错误:
hello.c:4:26: fatal error: openssl/rand.h no such file or directory
#include <openssl/rand.h>
hello.c:4:26:致命错误:openssl/rand.h没有这样的文件或目录
#包括
我必须向makefile添加什么才能使编译工作?
我找不到任何明确的例子。问题是openssl确实安装了,但没有安装
-devel
软件包
由于我在Opensuse上,以下是Yast中所需的软件包:
首先感谢@Etan Reisner和@Marian,找到openssl库头的路径,并使用
-I
参数将其传递给gcc。然后继续对lib文件执行同样的操作(或者切换到一个构建系统,比如cmake,它可以为您处理这个棘手的问题:)您需要找到包含openssl
路径的路径,并将-IThePathYouFound
添加到CFLAGS
,这些应该安装在标准位置,不需要特殊的-I
标志。您是否安装了openssl头文件?在大多数发行版上,它们不是普通的软件包,您需要匹配的-dev
或-devel
软件包。如果您在Linux上,您可能需要安装libssl dev
,请尝试sudo apt get install libssl dev
。
hello.c:4:26: fatal error: openssl/rand.h no such file or directory
#include <openssl/rand.h>