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

why "gtest" in ros giving CMake Error when i compile the code?

asked 2016-05-10 13:17:16 -0500

anilmullapudi gravatar image

updated 2016-05-12 04:44:43 -0500

gvdhoorn gravatar image

i am running a simple gtest, when i compile my package with catkin_make, i am getting below error. Can anyone help to resolve this?

CMake Error at /opt/ros/indigo/share/catkin/cmake/test/gtest.cmake:71 (message):
  catkin_add_executable_with_gtest() must be called after catkin_package() so
  that default output directories for the executables are defined
Call Stack (most recent call first):
  /opt/ros/indigo/share/catkin/cmake/test/gtest.cmake:34 (catkin_add_executable_with_gtest)
  ros_gtest/CMakeLists.txt:26 (catkin_add_gtest)

i followed this link

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-10 13:30:23 -0500

ahendrix gravatar image

The error explains itself reasonably well:

catkin_add_executable_with_gtest() must be called after catkin_package()

In your CMakeLists.txt, you need to call catkin_package() before you call catkin_add_executable_with_gtest().

It looks like the tutorial you're following is missing this step (but it's included in the author's sample repository)

edit flag offensive delete link more


Thank you so much, your answer was helped me to resolve the issue.

anilmullapudi gravatar image anilmullapudi  ( 2016-05-10 14:19:39 -0500 )edit

@anilmullapudi: please accept the answer by @ahendrix by clicking the checkmark to the left of it.

gvdhoorn gravatar image gvdhoorn  ( 2016-05-12 04:46:16 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-10 13:17:16 -0500

Seen: 1,017 times

Last updated: May 12 '16