CMake Error: add_executable cannot create target ““ because another target with the same name已解决


catkin_make报错输出如下:

CMake Error at experiment3/CMakeLists.txt:215 (add_executable):
  add_executable cannot create target "track" because another target with the
  same name already exists.  The existing target is an executable created in
  source directory "/home/zth/work_ws/src/experiment3".  See documentation
  for policy CMP0002 for more details.

解决方法:

CMakeLists.txt部分内容如下:
在这里插入图片描述
这里有两处忘记改了,改为如下内容即可:

add_executable(receive_process src/receive_process.cpp)
target_link_libraries(receive_process ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

add_executable(show_img src/show_img.cpp)
target_link_libraries(show_img ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

猜你喜欢

转载自blog.csdn.net/qq_44324181/article/details/112001384