如何修复 C error: undefined reference to MD5_Update

链接 OpenSSL 时,你可能会看到:

md5_link_error.txt
undefined reference to `MD5_Update'

确保你链接正确的 OpenSSL 库,例如:

gcc_openssl_example.sh
gcc -o myprog myprog.c -lcrypto

或使用 pkg-config:

pkgconfig_openssl.sh
gcc -o myprog myprog.c $(pkg-config --cflags --libs openssl)

Check out similar posts by category: C/C++