Code Monkey home page Code Monkey logo

Comments (4)

ras0219-msft avatar ras0219-msft commented on May 22, 2024 9

Hi Daniel,

You will need to additionally link the openssl libraries (libssl and libcrypto). These should probably be located at /usr/local/opt/lib.

-L /usr/local/opt/lib -lssl -lcrypto

from cpprestsdk.

gsmirnov94 avatar gsmirnov94 commented on May 22, 2024 2

I also had this problem. Thanks to @ras0219-msft!
My CMakeLists.txt:

cmake_minimum_required(VERSION 3.12)
project(main)

set(CMAKE_CXX_STANDARD 11)

##########################################################################

set(CPPRESTSDK_INCLUDE_DIR /Users/xok/DATA/Programming/libs/casablanca/Release/include)
set(CPPRESTSDK_SOURCE_DIR /Users/xok/DATA/Programming/libs/casablanca/build.debug/Binaries)

set(OPENSSL_INCLUDE_DIR /usr/local/Cellar/openssl/1.0.2p/include)
set(OPENSSL_SOURCE_DIR /usr/local/Cellar/openssl/1.0.2p/lib)

set(BOOST_INCLUDE_DIR /usr/local/Cellar/boost/1.67.0_1/include)
set(BOOST_SOURCE_DIR /usr/local/Cellar/boost/1.67.0_1/lib)

##########################################################################

set(SOURCES
main.cpp
)

##########################################################################

include_directories(${OPENSSL_INCLUDE_DIR})
include_directories(${CPPRESTSDK_INCLUDE_DIR})
include_directories(${BOOST_INCLUDE_DIR})

##########################################################################

add_executable(main ${SOURCES})

target_link_libraries(main
${CPPRESTSDK_SOURCE_DIR}/libcpprest.2.10.dylib
${CPPRESTSDK_SOURCE_DIR}/libcpprest.dylib
${OPENSSL_SOURCE_DIR}/libssl.dylib
${OPENSSL_SOURCE_DIR}/libcrypto.dylib
${BOOST_SOURCE_DIR}/libboost_system.dylib
)

from cpprestsdk.

danielmapar avatar danielmapar commented on May 22, 2024

If I include

-I/usr/local/opt/openssl/include

the output changes to:

g++ test.cpp -std=c++11 -I /Users/daniel/Desktop/workspace/casablanca/Release/include -L /Users/daniel/Desktop/workspace/casablanca/build.release/Binaries -I/usr/local/opt/openssl/include
Undefined symbols for architecture x86_64:
  "_CONF_modules_unload", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_CRYPTO_cleanup_all_ex_data", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_CRYPTO_num_locks", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
  "_CRYPTO_set_id_callback", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_CRYPTO_set_locking_callback", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_ENGINE_cleanup", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_ERR_free_strings", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_ERR_reason_error_string", referenced from:
      boost::asio::error::detail::ssl_category::message(int) const in test-2da509.o
  "_ERR_remove_thread_state", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_EVP_cleanup", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in test-2da509.o
  "_OPENSSL_add_all_algorithms_noconf", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
  "_SSL_library_init", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
  "_SSL_load_error_strings", referenced from:
      boost::asio::ssl::detail::openssl_init_base::do_init::do_init() in test-2da509.o
  "boost::system::system_category()", referenced from:
      ___cxx_global_var_init2 in test-2da509.o
      boost::asio::error::get_system_category() in test-2da509.o
  "boost::system::generic_category()", referenced from:
      ___cxx_global_var_init in test-2da509.o
      ___cxx_global_var_init1 in test-2da509.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

from cpprestsdk.

danielmapar avatar danielmapar commented on May 22, 2024

Thanks Ras! it works now

from cpprestsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.