vendredi 4 août 2023

undefined reference to Naoqi AL components in qt creator

I am writing my own walking controller for a Nao 5. My QT Creator does recognize that I have alcommon installed and available, since it suggests all of the components while I am coding.

However when I try to build the project, "undefined reference" errors are thrown.

I have already read in another post here that someone solved it by setting the cxx11 compiler flags, however that did not work for me.

I checked the tool chain, it seems to be set up just fine.

I am on a Ubuntu 20.04 system.

Can anybody help out? I really don't know where to go from here and my bachelor thesis is due 😅

I tried changing the order of commands in the camakelists, and tried setting compiler flags, both did not change anything.

Here is the cmakelists.txt:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

include_directories(/usr/include/ /usr/include/c++/11/ /usr/local/webots/lib/controller/ /usr/local/webots/include/controller/c/ /usr/local/webots/include/controller/cpp/)
link_directories( /usr/lib /usr/include/ /usr/include/c++/11/ /usr/local/webots/lib/controller/ /usr/local/webots/include/controller/c/ /usr/local/webots/include/controller/cpp/)

project(nao)

find_package(qibuild)


SET ( DCM_SRCS
        NaoqiDCM.cpp
        NaoqiDCM.h

        sensor.cpp
        sensor.h

        actuator.cpp
        actuator.h
)

SET (TEST_SRCS

#    webots_controller.h
#    webots_controller.cpp
    nao_controller.h
    nao_controller.cpp
    walk.cpp
    walk.h
    util.cpp
    util.h
    parameters.h

    sensor.h
    actuator.h
)

set(CMAKE_CXX_FLAGS"-D_GLIBCXX_USE_CXX11_ABI=0")

qi_create_bin(controller_nao ${TEST_SRCS})
qi_use_lib(controller_nao ALCOMMON)

set(WEBOTS_HOME "/usr/local/webots")
link_directories($ENV{WEBOTS_HOME}/lib/controller)
set (LIBRARIES m ${CMAKE_SHARED_LIBRARY_PREFIX}Controller${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}CppController${CMAKE_SHARED_LIBRARY_SUFFIX})
include_directories($ENV{WEBOTS_HOME}/include/controller/c $ENV{WEBOTS_HOME}/include/controller/cpp)




target_link_libraries(controller_nao ${LIBRARIES})

The errors read:

/usr/bin/ld: /home/michael/env/nao/nao_controller.cpp:20: undefined reference to `AL::DCMProxy::getTime(int const&)'

As an example, this happens pretty much for every ALCOMMON module I am trying to use.

Aucun commentaire:

Enregistrer un commentaire