0

I am new to C++ and external dependencies. Really don't know how to fix this compile error...

Error:

Undefined symbols for architecture x86_64:
  "uS::TLS::Context::~Context()", referenced from:

CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

project( opencv )

add_definitions(
        -std=c++11
)

find_package(OpenCV REQUIRED)

find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})

find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

add_executable( opencv main.cpp Camera.cpp Camera.h Communication.cpp Communication.h)

target_link_libraries( opencv
        ${OpenCV_LIBS}
        ${OPENSSL_LIBRARIES}
        ${ZLIB_LIBRARIES}
)
Dan Mašek
  • 17,852
  • 6
  • 57
  • 85
Dirk
  • 3,095
  • 4
  • 19
  • 37
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Tsyvarev Sep 25 '18 at 12:32
  • For use a function in the library you need to **link** with that library. In you case you need to link with "uWebsockets" library. In CMake linking is performed with `target_link_libraries` call. Absence of linking causes `Undefined symbols` error, as descibed in that answer to the referenced question: https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix/12574400#12574400. – Tsyvarev Sep 25 '18 at 12:33
  • @Tsyvarev I used `uWS -luv` which worked until I restarted my mac. `-L/usr/local/include/uWS` gives the same error again... – Dirk Sep 26 '18 at 17:33

0 Answers0