如何修复 C++ undefined reference to symbol 'BIO_ctrl_pending@@OPENSSL_3.0.0'
问题:
尝试使用类似以下命令编译使用 OpenSSL 的 C++ 程序时
build_cmd.sh
g++ -o myprogram myprogram.cpp -lssl你看到以下错误消息:
linker_error.txt
/usr/bin/ld: /tmp/ccEB0Pid.o: undefined reference to symbol 'BIO_ctrl_pending@@OPENSSL_3.0.0'
/usr/bin/ld: /lib/x86_64-linux-gnu/libcrypto.so.3: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status解决方案
你需要链接 crypto 和 ssl:
fix_build.sh
g++ -o myprogram myprogram.cpp -lcrypto -lsslCheck out similar posts by category:
GCC Errors
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow