0
$\begingroup$

Rosanswers logo

This is the error i received when compiling and i am not sure how to fix this error.

[100%] Building CXX object vision/CMakeFiles/vision1.dir/src/vision.cpp.o
Linking CXX executable /home/chiongsterx/catkin_ws/devel/lib/vision/vision1
/usr/bin/ld: cannot find -l&
collect2: ld returned 1 exit status
make[2]: *** [/home/chiongsterx/catkin_ws/devel/lib/vision/vision1] Error 1
make[1]: *** [vision/CMakeFiles/vision1.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed

This is my cmakelists. Not sure whethere package is placed correctly

find_package(catkin REQUIRED COMPONENTS
 roscpp
 rospy
 std_msgs
 cv_bridge
 image_geometry

)
find_package(OpenCV REQUIRED

)
include_directories(
${catkin_INCLUDE_DIRS} & ${OpenCV_INCLUDE_DIRS}
)
add_executable(vision1 src/vision.cpp)
target_link_libraries(vision1
   ${catkin_LIBRARIES} & ${OpenCV_LIBRARIES}
)

Originally posted by chiongsterx on ROS Answers with karma: 33 on 2014-07-30

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You've specified an ampersand character ( & ) in your include directories and as a library to link to - the linker is simply informing you that it can't find a library named &

You don't need to use the & as a separator when specifying multiple include directories or libraries in CMake - whitespace is sufficient.

(If any of the documentation suggests that you should use & in this fashion, it is wrong and should be corrected)


Originally posted by ahendrix with karma: 47576 on 2014-07-30

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

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