boost::asio::ssl linking errors in Xcode 4

匿名 (未验证) 提交于 2019-12-03 01:06:02

问题:

I have a simple project in Xcode―it doesn't actually do anything yet, just includes boost::asio::ssl:

// main.cpp  #include <iostream> #include <string> #include <boost/asio.hpp> #include <boost/asio/ssl.hpp>  using namespace std ;  int main (int argc, const char * argv [] ) {     return 0 ; } 

I have it linked with libssl.dylib and libboost_system.dylib, and get this when building:

Undefined symbols for architecture x86_64:   "_CONF_modules_unload", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_CRYPTO_cleanup_all_ex_data", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_CRYPTO_num_locks", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in main.o   "_CRYPTO_set_id_callback", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in main.o       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_CRYPTO_set_locking_callback", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in main.o       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_ENGINE_cleanup", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_ERR_free_strings", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_ERR_reason_error_string", referenced from:       boost::asio::error::detail::ssl_category::message(int) const in main.o   "_ERR_remove_state", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_EVP_cleanup", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in main.o   "_OPENSSL_add_all_algorithms_noconf", referenced from:       boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Is there some other library I'm missing or something else I've overlooked?

回答1:

I think you need to link against libcrypto as well -lcrypto



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!