架构x86_64的未定义符号:"_ SSLv2_ ..."; [英] Undefined symbols for architecture x86_64: "_SSLv2_ ..."

查看:92
本文介绍了架构x86_64的未定义符号:"_ SSLv2_ ...";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to build a small example for a Telegram Bot library in C++ (https://github.com/reo7sp/tgbot-cpp#samples) but when linking I get this output:

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)...对于新手问题,感到抱歉.

I have openssl 1.0.2 installed: do I have to get a 2.x version? I can't find it with homebrew (my system is OSX 10.9.5)... sorry for the newbie question.

推荐答案

  1. brew install openssl

打开~/.bash_profile

添加

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

这篇关于架构x86_64的未定义符号:"_ SSLv2_ ...";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆