undefined reference to tfxui::Loop #634
-
I am currently trying to implement FTXUI into an existing loop in my project but i am getting this error when compiling: The complete error is following: rosmelodic@rosmelodic:~/catkin_ws$ catkin_make
Base path: /home/rosmelodic/catkin_ws
Source space: /home/rosmelodic/catkin_ws/src
Build space: /home/rosmelodic/catkin_ws/build
Devel space: /home/rosmelodic/catkin_ws/devel
Install space: /home/rosmelodic/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/rosmelodic/catkin_ws/build"
####
####
#### Running command: "make -j6 -l6" in "/home/rosmelodic/catkin_ws/build"
####
[ 0%] Built target Histogram
[ 11%] Built target screen
[ 14%] Built target ROI
[ 17%] Built target Telemetry
[ 23%] Built target PolyFit
[ 23%] Built target LDA_module
[ 70%] Built target dom
[ 97%] Built target component
[100%] Building CXX object lane-detector/CMakeFiles/lane_detector.dir/src/lane_detector.cpp.o
[100%] Linking CXX executable /home/rosmelodic/catkin_ws/devel/lib/lane_detector/lane_detector
CMakeFiles/lane_detector.dir/src/lane_detector.cpp.o: In Funktion »main«:
lane_detector.cpp:(.text+0x1321): Warnung: undefinierter Verweis auf »ftxui::Loop::Loop(ftxui::ScreenInteractive*, std::shared_ptr<ftxui::ComponentBase>)«
lane_detector.cpp:(.text+0x162f): Warnung: undefinierter Verweis auf »ftxui::Loop::~Loop()«
lane_detector.cpp:(.text+0x1993): Warnung: undefinierter Verweis auf »ftxui::Loop::~Loop()«
collect2: error: ld returned 1 exit status
lane-detector/CMakeFiles/lane_detector.dir/build.make:167: recipe for target '/home/rosmelodic/catkin_ws/devel/lib/lane_detector/lane_detector' failed
make[2]: *** [/home/rosmelodic/catkin_ws/devel/lib/lane_detector/lane_detector] Error 1
CMakeFiles/Makefile2:1299: recipe for target 'lane-detector/CMakeFiles/lane_detector.dir/all' failed
make[1]: *** [lane-detector/CMakeFiles/lane_detector.dir/all] Error 2
Makefile:165: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j6 -l6" failed The CMakesLists.txt is as follows (i cut some other linked libraries): cmake_minimum_required(VERSION 3.11)
set (CMAKE_CXX_STANDARD 17)
# --- Fetch FTXUI ---------------------------------------------------------------
include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
FetchContent_Declare(ftxui
GIT_REPOSITORY https://github.com/ArthurSonzogni/ftxui
GIT_TAG v4.0.0
)
FetchContent_GetProperties(ftxui)
if(NOT ftxui_POPULATED)
FetchContent_Populate(ftxui)
add_subdirectory(${ftxui_SOURCE_DIR} ${ftxui_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
# -------------------------------------------------------------------------------
project(lane_detector
LANGUAGES CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
find_package(catkin REQUIRED COMPONENTS
cv_bridge
message_generation
roscpp
rospy
sensor_msgs
std_msgs
)
find_package(
OpenCV
)
add_message_files(
FILES
Lane.msg
)
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS cv_bridge message_runtime roscpp rospy sensor_msgs std_msgs
)
include_directories(
include
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
link_directories(${OpenCV_LIBRARY_DIRS})
add_executable(lane_detector src/lane_detector.cpp)
[...]
target_link_libraries(lane_detector ${catkin_LIBRARIES})
target_link_libraries(lane_detector ${OpenCV_LIBRARIES})
target_link_libraries(lane_detector
ftxui::screen
ftxui::dom
ftxui::component
) The Code i implemented: auto screen = ScreenInteractive::Fullscreen();
// Create a component counting the number of frames drawn and event handled.
int custom_loop_count = 0;
int frame_count = 0;
int event_count = 0;
auto component = Renderer([&] {
frame_count++;
return vbox({
text("This demonstrates using a custom ftxui::Loop. It "),
text("runs at 100 iterations per seconds. The FTXUI events "),
text("are all processed once per iteration and a new frame "),
text("is rendered as needed"),
separator(),
text("ftxui event count: " + to_string(event_count)),
text("ftxui frame count: " + to_string(frame_count)),
text("Custom loop count: " + to_string(custom_loop_count)),
}) |
border;
});
component |= CatchEvent([&](Event) -> bool {
event_count++;
return false;
});
Loop loop = Loop(&screen, component); Inside Header: #include <ftxui/dom/elements.hpp>
#include <ftxui/screen/screen.hpp>
#include <ftxui/component/component.hpp>
#include <ftxui/component/loop.hpp>
#include <ftxui/component/screen_interactive.hpp> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Solution: clean and build with clion The problem got solved. Catkin is unable to independently download the files from the git and upgrade from 3.0.0 to 4.0.0. Clion, on the other hand, took FTXUI files to some other directory and pretended everything was there, resulting in the IDE showing no error and still failing to build the project. |
Beta Was this translation helpful? Give feedback.
Solution: clean and build with clion
The problem got solved. Catkin is unable to independently download the files from the git and upgrade from 3.0.0 to 4.0.0. Clion, on the other hand, took FTXUI files to some other directory and pretended everything was there, resulting in the IDE showing no error and still failing to build the project.