Catkin make fails after adding gtest
Hello,
I have a package, that contains custom messages and services. This package was building well and everything was ok. But recently I added gtest
to my package and faced with some interesting issue. If I build my package with:
catkin_make my_pkg_name
It builds ok, gtest also works after
catkin_make run_test_my_pkg_name_gtest
But if I try catkin_make
without any arguments it fails with this error:
/home/user/catkin_ws/src/my_pkg_name/include/my_pkg_name/map_handler.h:8:10:
fatal error: custom_msgs/Map.h: no such file or directory
include "custom_msgs/Map.h"
^~~~~~~~~~~~~~~ compilation terminated
where Map.h is a definition of my custom service. If I switch to version of my package without gtest catkin_make
works again.
I suppose that problem connects with gtest module which doesn't know something about my custom messages and services at the building time. But strange that it works for building only one package (not whole catkin directory).
Any ideas on this case? I would appreciate practical advise how to solve this problem and theoretical explanations about catkin_make features.
Do you have your non-test code and your test code in different directories? The different directories might make some difference. In this case, you may be able to solve it by writing
include_directories
.Yes, my test code is in folder called test. If I move it to the src folder error doesn't disappear. Also I tried to add test folder in
include_directories
but result was the same.You can get the build details by enabling
VERBOSE=1
. Can you please tryand
There should be some difference.
Yes, results of above commands execution are difference. There are a lot of some different message and I actually don't understand what I should do with this information. As I can see the
catkin_make run_test_my_pkg_name_gtest VERBOSE=1
enters into my_package_name directory only, whencatkin_make my_pkg_name VERBOSE=1
enters into custom_msgs directory which contains definitions of my custom messages. Does this information tell you anything?If you share the messages and CMakeLists.txt with us, we may be able to notice something.
OK, There is my CMakeLists.txt, this is output of
catkin_make my_pkg_name VERBOSE=1
and this is output ofcatkin_make run_test_my_pkg_name_gtest VERBOSE=1