Package can't be build

asked 2018-03-20 07:34:37 -0500

Ibrahim_aerospace gravatar image

updated 2018-03-20 08:03:06 -0500

Hello all ! I can't build the package. First i created the package. and then modified CMakelist.txt and Package.xml files. as required. At the time of typing catkin_make command, the following error appears.

  CMake Error at ros_tutorials_topic/CMakeLists.txt:143 (add_executable):
  Cannot find source file:

    src/ros_tutorials_topic_node.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx
CMake Error: CMake can not determine linker language for target: ros_tutorials_topic
CMake Error: Cannot determine link language for target "ros_tutorials_topic".
CMake Error: CMake can not determine linker language for target: ros_tutorials_topic_node
CMake Error: Cannot determine link language for target "ros_tutorials_topic_node".
-- Generating done
-- Build files have been written to: /home/ibrahim/catkin_ws/build
Makefile:1690: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

It refers to this line in CMakelists.txt file

## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide

How to fix this problem. Please

   add_executable(${PROJECT_NAME}_node src/ros_tutorials_topic_node.cpp)
edit retag flag offensive close merge delete

Comments

1

Does the file ros_tutorials_topic/src/ros_tutorials_topic_node.cpp (relative to your catkin workspace) actually exists? Check for typos in the filename (or do ls ros_tutorials_topic/src/ros_tutorials_topic_node.cpp).

Maarten gravatar image Maarten  ( 2018-03-20 10:07:19 -0500 )edit

Sir this is exactly the problem that when i build test_pkg in ROS by default, then that CPP file is there. but when i make a package of my own then it gives me this error.

Ibrahim_aerospace gravatar image Ibrahim_aerospace  ( 2018-03-21 02:31:09 -0500 )edit

Can you post the full CMakeLists.txt and tell us which files are actually present (e.g. the output of the tree command)? Without that information, it's more or less impossible to see what's going on.

Maarten gravatar image Maarten  ( 2018-03-21 03:33:10 -0500 )edit

thanks sir, i solved it. bundle of thanks

Ibrahim_aerospace gravatar image Ibrahim_aerospace  ( 2018-03-21 10:24:30 -0500 )edit

Maybe it is interesting for future visitors to tell what the problem was.

Maarten gravatar image Maarten  ( 2018-03-21 15:28:17 -0500 )edit

actually sir the problem was not so complicated but as i am new so it looks difficult to me. i just removed this line from XML file. add_executable(${PROJECT_NAME}_node src/ros_tutorials_topic_node.cpp)

Ibrahim_aerospace gravatar image Ibrahim_aerospace  ( 2018-03-23 05:31:22 -0500 )edit