0
$\begingroup$

Rosanswers logo

I have two versions of src file in the package under the workspace. I ran one and named the other src2 (CmakeList.txt compiles the source file in src directory). Then I want to run the other version files, so src is renamed to src1 and src2 is renamed to src, and I ran catkin_make in the workspace, but there is no new file generated and when I start the node, it' s still the old one. It's so weird. Can someone explain it?


Originally posted by Liulong Ma on ROS Answers with karma: 23 on 2019-08-21

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I have two versions of src file in the package under the workspace

I understand it as both your src folder contains files with the same names and same CMakeList but only some lines of code differs between the two. That being said when you run catkin_make after swapping your folders catkin doesn't notice any change in your files (I don't really know how, probably CMake related, but if someone can enlighten me on this part) so if nothing has changed catkin won't rebuild everything as usual.

To avoid that you have two options :

  1. Delete the build and devel folder each time you change the src folder
  2. Change a little thing in a file so that catkin notice a change and rebuild the package

The best option is the first one but I would recommend for that kind of things to use a version-control tool such as GIT or SVN.


Originally posted by Delb with karma: 3907 on 2019-08-21

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by PeteBlackerThe3rd on 2019-08-21:
I think make will only rebuild a file if the source has a more recent timestamp than the last time it was built, so by renaming the same files I don't think it will pickup the change because it will still have it's original timestamp. Not 100% sure on this, but try adding a single space to update the timestamp and try it again.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.