我正在尝试制作一个 SSL 套接字。我做了一些研究,我也在 stackoverflow 中找到了这个答案:
Turn a simple socket into an SSL socket
我创建了一个 C 文件并包含相同的 header :
#include <openssl/applink.c>
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
但是当我尝试编译它时,它会出现这个错误:
socketMng.c:12:10: fatal error: openssl/applink.c: No such file or directory
#include <openssl/applink.c>
我在 /usr/include/openssl/
中找不到该文件。
我在名为 mn 的文件夹中找到该文件...我还包括使用引号而不是该文件夹中的 <> 但不起作用。
.c 可以包含在标题中吗? (我没见过) 我该如何解决?
我已经安装了 libssl-dev
。
谢谢
最佳答案
Can .c file be included from the header?
是的。 include
所做的只是获取一个文件并粘贴其内容,而不是 include
语句。取决于你问的是谁,这可能是糟糕的设计,但它是完全有效的。
关于c - 如何编译或链接作为标题包含的 .c 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50368707/