0
$\begingroup$

Rosanswers logo

I'm sorry if this is not the right forum for this error.

The file structure with CMakeLists and relavant cpp sources:

src/BioSentry/
├── CMakeLists.txt
├── LICENSE
├── README.md
├── include
│   ...
├── launch
│   ...
├── msg
│   ...
├── package.xml
└── src
    ├── image_publisher_node.cpp
    ├── person_detector_node.cpp
    └── rtmp_receiver_node.cpp

Lines from CMakeLists:

add_executable(       ${PROJECT_NAME}_rtmp_receiver_node src/rtmp_receiver_node.cpp)
target_link_libraries(${PROJECT_NAME}_rtmp_receiver_node ${catkin_LIBRARIES} ${OpenCV_LIBS} ${OpenCV_LIBRARIES} )

add_executable(       ${PROJECT_NAME}_image_publisher_node src/image_publisher_node.cpp)
target_link_libraries(${PROJECT_NAME}_image_publisher_node ${catkin_LIBRARIES} ${OpenCV_LIBS} ${OpenCV_LIBRARIES} )

add_executable(       ${PROJECT_NAME}_person_detector_node src/person_detector_node.cpp)
target_link_libraries(${PROJECT_NAME}_person_detector_node ${catkin_LIBRARIES} )

There first two executables have no problems finding the cpp sources in the src folder but the third cannot be found even though it's right next to the others:

thimo@6G-mast:~/catkin_ws$ catkin_make
Base path: /home/thimo/catkin_ws
Source space: /home/thimo/catkin_ws/src
Build space: /home/thimo/catkin_ws/build
Devel space: /home/thimo/catkin_ws/devel
Install space: /home/thimo/catkin_ws/install
####
#### Running command: "cmake /home/thimo/catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/thimo/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/thimo/catkin_ws/install -G Unix Makefiles" in "/home/thimo/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/thimo/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/thimo/catkin_ws/devel;/opt/ros/noetic
-- This workspace overlays: /home/thimo/catkin_ws/devel;/opt/ros/noetic
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.5", minimum required is "3")
-- Using PYTHON_EXECUTABLE: /usr/bin/python3
-- Using Debian Python package layout
-- Using empy: /usr/lib/python3/dist-packages/em.py
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/thimo/catkin_ws/build/test_results
-- Forcing gtest/gmock from source, though one was otherwise available.
-- Found gtest sources under '/usr/src/googletest': gtests will be built
-- Found gmock sources under '/usr/src/googletest': gmock will be built
-- Found PythonInterp: /usr/bin/python3 (found version "3.8.5")
-- Using Python nosetests: /usr/bin/nosetests3
-- catkin 0.8.9
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - biosentry_crowd_detection
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'biosentry_crowd_detection'
-- ==> add_subdirectory(BioSentry)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- biosentry_crowd_detection: 1 messages, 0 services
-- Configuring done
CMake Error at BioSentry/CMakeLists.txt:153 (add_executable):
  Cannot find source file:

    src/person_detector_node.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx


CMake Error at BioSentry/CMakeLists.txt:153 (add_executable):
  No SOURCES given to target: biosentry_crowd_detection_person_detector_node


CMake Generate step failed.  Build files cannot be regenerated correctly.
Invoking "cmake" failed
thimo@6G-mast:~/catkin_ws$ ls /home/thimo/catkin_ws/src/BioSentry/src/
image_publisher_node.cpp  person_detector_node.cpp  rtmp_receiver_node.cpp

I'm using Ubuntu 20.04 WSL terminal om Windows 10 with vscode. From the terminal I can see that the changes in the src dir made by vscode are present.

EDIT: Well, I immediately found the problem so I will leave the solution here for the next poor soul: When creating a new file via vscode from my windows host in the WSL filesystem the file does show up with ls but I don't have permission to open it. This is probably why catkin_make can't find it. Connecting to the WSL target using vscode remote explorer menu will avoid this in the future!


Originally posted by ThimoF on ROS Answers with karma: 36 on 2021-02-23

Post score: 0


Original comments

Comment by gvdhoorn on 2021-02-23:
Please post your EDIT as an answer and accept your own answer.

Comment by gvdhoorn on 2021-02-23:
And for future questions: please don't post screenshots of terminals/cmd windows. It's all text, so copy-paste it into your question.

Comment by ThimoF on 2021-02-23:
I fixed the screenshots but I don't have enough points to reopen de question :/

Comment by gvdhoorn on 2021-02-23:
I've re-opened it.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Well, I immediately found the problem so I will leave the solution here for the next poor soul: When creating a new file via vscode from my windows host in the WSL filesystem the file does show up with ls but I don't have permission to open it. This is probably why catkin_make can't find it. Connecting to the WSL target using vscode remote explorer menu will avoid this in the future!


Originally posted by ThimoF with karma: 36 on 2021-02-23

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.