gpt4 book ai didi

c++ - 体系结构 x86_64 : "_SSLv2_ ..." 的 undefined symbol

转载 作者:太空宇宙 更新时间:2023-11-04 13:18:42 25 4
gpt4 key购买 nike

我正在尝试用 C++ ( https://github.com/reo7sp/tgbot-cpp#samples ) 为 Telegram Bot 库构建一个小示例,但是在链接时我得到了这个输出:

Undefined symbols for architecture x86_64:
"_SSLv2_client_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
"_SSLv2_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
"_SSLv2_server_method", referenced from:
boost::asio::ssl::context::context(boost::asio::ssl::context_base::method) in libTgBot.a(HttpClient.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

使用这个命令:

g++ -std=c++11 main.cpp -l boost_system -l boost_iostreams -l boost_unit_test_framework -l boost_exception -l TgBot -l pthread -l ssl -l crypto -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include

我已经安装了 openssl 1.0.2:我必须获得 2.x 版本吗?我无法用自制软件找到它(我的系统是 OSX 10.9.5)...抱歉新手问题。

最佳答案

  1. brew install openssl

  2. 打开~/.bash_profile

  3. 添加

export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
  1. 来源 ~/.bash_profile

关于c++ - 体系结构 x86_64 : "_SSLv2_ ..." 的 undefined symbol ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36200065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com