问题
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)
using this command:
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
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
open
~/.bash_profile
add
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
- source ~/.bash_profile
来源:https://stackoverflow.com/questions/36200065/undefined-symbols-for-architecture-x86-64-sslv2