0
$\begingroup$

Rosanswers logo

Hi all,

I am trying to fix a compiling problem for a week now, without success. :(

Basically I am implementing this tutorial: http://wiki.ros.org/image_transport/Tutorials/PublishingImages

However, when I compile, I get the following errors:

In file included from /opt/ros/groovy/include/opencv2/opencv.hpp:47:0,
                 from /home/ruud/Dropbox/ros/catkin_workspace/src/test_package/include/node.h:14,
                 from /home/ruud/Dropbox/ros/catkin_workspace/src/test_package/src/node.cpp:1:
/opt/ros/groovy/include/opencv2/core/core.hpp:4126:9: error: expected identifier before ‘int’
/opt/ros/groovy/include/opencv2/core/core.hpp:4126:9: error: expected ‘}’ before ‘int’
/opt/ros/groovy/include/opencv2/core/core.hpp:4126:12: error: expected unqualified-id before ‘=’ token
/opt/ros/groovy/include/opencv2/core/core.hpp:4141:22: error: expected unqualified-id before ‘)’ token
/opt/ros/groovy/include/opencv2/core/core.hpp:4143:14: error: expected unqualified-id before ‘const’
/opt/ros/groovy/include/opencv2/core/core.hpp:4143:14: error: expected ‘)’ before ‘const’ ....

In the CMakeLists.txt I have added the following according to the tutorial:

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(node ${OpenCV_LIBRARIES})

In the package.xml I have added:

  <build_depend>cv_bridge</build_depend>
  <build_depend>image_transport</build_depend>
  <run_depend>cv_bridge</run_depend>
  <run_depend>image_transport</run_depend>

On the website here (http://wiki.ros.org/opencv2) I read OpenCV is deprecated under groovy and you need to install it as a third party library? However, why are there OpenCV packages installed under /opt/ros/groovy/include/opencv and /opt/ros/groovy/include/opencv2.

Very confusing! :)

Thanks, Ruud


Originally posted by Ruud on ROS Answers with karma: 212 on 2014-10-26

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

YOu still need catkin_LIBRARIES / catkin_INCLUDE_DIRS in your CMakeLists.txt.... Is there anything included in your file before / after core.hpp taht may interfere with core.hpp?


Originally posted by Wolf with karma: 7555 on 2014-10-27

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

That worked! All I needed to do change the order of the includes in my source. I put the following includes before the other includes.

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <cv_bridge/cv_bridge.h>

Originally posted by Ruud with karma: 212 on 2014-10-27

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

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