-2
我試圖在使用CMake的Mac上在CLion上使用CPPREST SDK。我幾乎沒有,但我似乎無法解決以下鏈接錯誤:在Mac上使用CMake的CLion上的CPPREST SDK
Undefined symbols for architecture x86_64:
"_ERR_remove_thread_state", referenced from:
boost::asio::ssl::detail::openssl_init_base::do_init::~do_init() in PongRemote.cpp.o
我指定-lssl和-lcrypto,但仍得到這個「線程狀態」的錯誤。基於一些研究,它看起來像來自OpenSSL。我用Homebrew來安裝CPPREST。
我有真的只是一個主要測試這一點,基本包括:
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
用的CMake的:
project(cpprest)
cmake_minimum_required(VERSION 3.8)
set(CMAKE_CXX_STANDARD 14)
# BOOST PACKAGE
find_package(Boost REQUIRED COMPONENTS
atomic
chrono
date_time
exception
filesystem
random
regex
serialization
system
thread
)
include_directories(${Boost_INCLUDE_DIRS})
IF (!Boost_FOUND)
MESSAGE("*** ERROR *** Boost package not found")
RETURN()
ENDIF()
# Microsoft RESTful API Package (Casablanca)
set(CPPREST_LIBRARIES "/usr/local/opt/openssl/lib")
include_directories("/usr/local/opt/openssl/include")
# Compile and link
# Build the core library and executable
include_directories(${CMAKE_SOURCE_DIR})
set(SOURCE_FILES
main.cpp
)
set(LINK_LIBRARIES
${Boost_LIBRARIES}
${CPPREST_LIBRARIES}
-lssl
-lcrypto
)
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES})
的可能的複製[什麼是未定義參考/解析的外部符號錯誤,以及如何解決呢?(https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference -unresolved-external-symbol-error-and-how-do-i-fix) – user0042
我檢查過了。我從字面上只有一個主要和包括:#包括# #包括 –