ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

External Library Link Error [closed]

asked 2011-08-11 18:25:18 -0600

Dongjun gravatar image

updated 2011-09-02 11:47:26 -0600

kwc gravatar image

I'm trying to use external library file "libdssp_rs232_drive_module.so".

I met following error message.

Linking CXX executable ../dssp

CMakeFiles/dssp.dir/src/dssp.o: In function `main':

/home/hass/my_robot/dssp/src/dssp.cpp:9: undefined reference to `dssp_rs232_drv_module_create(char const*, int)'

collect2: ld returned 1 exit status

------------------------------------------------------------------------------
My setup files are followings

CMakeLists.txt

cmake_minimum_required(VERSION 2.4.6)

include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)

rosbuild_init()

rosbuild_add_executable(dssp src/dssp.cpp)

target_link_libraries(dssp dssp_rs232_drive_module)

manifest.xml

<package>

...

<export>

  <cpp cflags="-I${prefix}/include" lflags="-L${prefix}/lib -Wl,-rpath,${prefix}/lib -ldssp_rs232_drive_module"/>

</export>

</package>

How can I solve this problem?

PS. I tried to make execution file of microstrain_3dmgx2_imu Package, which is the officially published package in ROS DIAMONDBACK. sudo make clean sudo make But I met the same error massage. Why does the officially published package have the same link error?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by kwc
close date 2012-02-29 07:53:18

Comments

It seems that the library doesn't provide the call, which shouldn't be. What system are you using? To verify its linked, you can VERBOSE=1 make, to show compiler lines.
dornhege gravatar image dornhege  ( 2011-08-12 02:04:43 -0600 )edit
BTW: You don't need the export in the manifest. That is for other packages using libraries that you build.
dornhege gravatar image dornhege  ( 2011-08-12 02:06:17 -0600 )edit
you can try running "nm libdssp_rs232_drive_module.so |grep dssp_rs232_drv_module_create" to see if that symbol is available in your library
Markus Achtelik gravatar image Markus Achtelik  ( 2011-09-02 12:05:33 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2011-08-13 05:21:31 -0600

Zack gravatar image

change the following line

from target_link_libraries(dssp dssp_rs232_drive_module)

to target_link_libraries(dssp /pathto/libdssp_rs232_drive_module.so)

where pathto is the path to ur libdssp_rs232_drive_module.so file

edit flag offensive delete link more

Comments

Can you post your edited CMakeLists.txt? And perhaps you might want to consider posing your comments as comments
Zack gravatar image Zack  ( 2011-08-22 15:27:11 -0600 )edit
-1

answered 2011-08-21 16:35:12 -0600

Dongjun gravatar image

The answer doesn't solve the problem. And, the error message is same to the previous one.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2011-08-11 18:25:18 -0600

Seen: 565 times

Last updated: Sep 02 '11