0
$\begingroup$

Rosanswers logo

Hello, I am currently attempting to repackage a C++ device driver into a ROS node that will accomplish the same thing. However, the project is dependent on the ncurses library, and I am apparently not correctly linking the library, because I am getting a bunch of undefined reference errors to functions that, in the code are comment-labeled as coming from the ncurses library. How do I properly link this library in my CMakeLists file? This is what I have right now, but its not working:

add_executable(steering_keyboard_node src/steering_keyboard_node.cpp include/steeringKeyboard/workmanComm.cpp include/steeringKeyboard/workmanParams.cpp include/steeringKeyboard/ /usr/include/ncurses.h /usr/include/curses.h)
target_link_libraries(steering_keyboard_node ${catkin_LIBRARIES})

Originally posted by mysteriousmonkey29 on ROS Answers with karma: 170 on 2014-07-25

Post score: 1


Original comments

Comment by tfoote on 2014-07-26:
Please show the errors you are getting and provide enough information on how to reproduce the problem. . Otherwise we have to guess what you are doing wrong.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Some time ago i has the same problem, but on ros fuerte version with rosbuild, maybe the solution still working my solution consist on add: <rosdep name="ncurses++"/> to the manifest and on the CMakeLists something like that

find_package( PkgConfig REQUIRED )
pkg_check_modules ( ncurses++ REQUIRED ncurses++ )

rosbuild_add_executable(vant    
    src/....cpp
    src/....cpp
)
rosbuild_genmsg ()

target_link_libraries ( vant ${ncurses++_LIBRARIES})

sorry for my english.


Originally posted by vitor.ecomp with karma: 16 on 2014-07-26

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by ahendrix on 2014-07-26:
Note that these instructions are for rosbuild. For cakin, change to <build_depend>ncurses++</build_depend> and rosbuild_add_executable to add_executable

Comment by mysteriousmonkey29 on 2014-07-28:
Thanks guys, adding build and run depend to my package.xml:

<build_depend>ncurses++</build_depend> <run_depend>ncurses++</run_depend> braries and adding ${ncurses++_LIBRARIES} into my CMakeLists target_link_libraries line solved the problem.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.