对“BIO_s_mem”的未定义引用

undefined reference to `BIO_s_mem'

这是我的代码:

#include <openssl/bio.h>
int main (void)
{
    BIO* bo = BIO_new(BIO_s_mem());
}

我正在通过 gcc -lcrypto test.c.

编译我的代码

知道哪里出了问题吗?

你的参数顺序错误,试试gcc test.c -lcrypto

why order matters