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

can not link library files

asked 2011-09-13 01:52:36 -0600

updated 2011-09-13 02:04:18 -0600

dornhege gravatar image

Hi, I am using ubuntu natty 11.04 and i am trying to use external library: ueye_api while using ueye camera to capture frames and publish them as ros messages by creating a node roscam

To include external library files I made the necessary changes in CMakeLists.txt file:

rosbuild_add_executable(roscam src/roscam.cpp)
link_directories(/usr/lib /usr/local/share/ueye/ /usr/include /usr/local/share/ueye/ueyeusbd)
include_directories(/usr/lib /usr/local/share/ueye/ /usr/include /usr/local/share/ueye/ueyeusbd)
target_link_libraries(roscam libueye_api libueye_api.so libueye_api.so.1 libueye_api.so.3.82)

But still I received following error while compiling a program:

 Linking CXX executable ../bin/roscam
  /usr/bin/ld: cannot find -llibueye_api
  /usr/bin/ld: cannot find -llibueye_api.so.1
  /usr/bin/ld: cannot find -llibueye_api.so.3.82
  collect2: ld returned 1 exit status
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-09-13 02:09:21 -0600

dornhege gravatar image

The linker cannot find the libraries in the directories you specified. Where are the files located?

You can check with VERBOSE=1 make what the exact linker line is. There should be an entry like -L<dir to library> -l<library_name>.

Your cmake file should only need to contain include_directories() for the directory where the header files are (e.g. /usr/include, and other system includes should not need to be listed here). link_directories should only contain the directory where the library files are.

edit flag offensive delete link more

Comments

Thanks!! it is working by removing the link_directories() command and in include_directories() by removing the unnecessary directories and just keeping /usr/include which contains the header file. And also the libraries libueye_api.so.1 and libueye_api.so.3.82 are not required
abhinav gravatar image abhinav  ( 2011-09-13 03:26:17 -0600 )edit
actually /usr/include shouldn't be required
dornhege gravatar image dornhege  ( 2011-09-13 06:04:10 -0600 )edit
Yes it should because I was initially trying to link it with some unnecessary library files which it could not find anyway.
abhinav gravatar image abhinav  ( 2011-09-13 19:37:00 -0600 )edit

Question Tools

Stats

Asked: 2011-09-13 01:52:36 -0600

Seen: 2,096 times

Last updated: Sep 13 '11