Ask Your Question
0

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

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

anilmullapudi gravatar image

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

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 http://ysonggit.github.io/coding/2014...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Comments

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

anilmullapudi gravatar imageanilmullapudi ( 2016-05-10 14:19:39 -0600 )edit

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

gvdhoorn gravatar imagegvdhoorn ( 2016-05-12 04:46:16 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 552 times

Last updated: May 12 '16