取消引用指向不完整类型 openSSL 的指针

Dereferencing pointer to incomplete type openSSL

我正在使用 openssl 库。在 apps/s_client.c 文件中,我试图访问 con 变量,它声明如下:

SSL *con=NULL;
con=SSL_new(ctx);

但是,每当我尝试访问 con 的任何成员时,例如, con->version,我收到此错误:

s_client.c: In function ‘s_client_main’:
s_client.c:1667: error: dereferencing pointer to incomplete type

我应该包含什么头文件?

所有 headers 都已包含,您只需在包含 ssl.h 之前删除 OPENSSL_NO_SSL_INTERN。

apps/s_client.c:

...
#undef OPENSSL_NO_SSL_INTERN
#include <openssl/ssl.h>