MAVSDK icon indicating copy to clipboard operation
MAVSDK copied to clipboard

Undefined symbols for architecture x86_64:

Open lxj5891 opened this issue 2 years ago • 3 comments

Undefined symbols for architecture x86_64: "mavsdk::Connection::Connection(std::__1::function<void (__mavlink_message&, mavsdk::Connection*)>)", referenced from: mavsdk::TcpConnection::TcpConnection(std::__1::function<void (__mavlink_message&, mavsdk::Connection*)>, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, int) in tcp_connection.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) make[2]: *** [bkserver] Error 1 make[1]: *** [CMakeFiles/bkserver.dir/all] Error 2 make: *** [all] Error 2

do you help me?

lxj5891 avatar Mar 17 '22 16:03 lxj5891

My CMakeLists.txt

cmake_minimum_required(VERSION 3.0.0)

project(bkserver VERSION 0.1)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

cmake_policy(SET CMP0025 NEW)

configure_file (
  "${PROJECT_SOURCE_DIR}/include/config.h.in"
  "${PROJECT_BINARY_DIR}/include/config.h"
)

include(GNUInstallDirs)

set(THREADS_PREFER_PTHREAD_FLAG ON)

find_package(Threads REQUIRED)
find_package(MAVSDK REQUIRED)

AUX_SOURCE_DIRECTORY(./src SRC_LIST_CPP ${SRC_LIST_CPP})

add_executable(bkserver src/main.cpp ${SRC_LIST_CPP})

target_link_libraries(bkserver
    MAVSDK::mavsdk
    Threads::Threads
)

lxj5891 avatar Mar 17 '22 16:03 lxj5891

On what system are you running? How did you install MAVSDK? Which version?

JonasVautherin avatar Mar 17 '22 20:03 JonasVautherin

What @JonasVautherin said and maybe you can also share where the code where you're adding the MAVSDK connections. Maybe you're "doing it wrong" and that's why it tries to instantiate the connections in a way that's not supported.

julianoes avatar Mar 18 '22 00:03 julianoes

Closing as there was response.

julianoes avatar Mar 20 '23 04:03 julianoes