Ask Your Question

Kurt's profile - activity

2017-05-26 12:22:32 -0500 received badge  Famous Question (source)
2014-10-24 21:42:13 -0500 received badge  Notable Question (source)
2014-08-22 11:08:11 -0500 received badge  Popular Question (source)
2014-08-21 17:11:27 -0500 commented answer Linker error trying to build and run unit tests

Cool that seems to have worked, I've managed to build and the the tests by modifying the target_link_libraries to this target_link_libraries(${PROJECT_NAME}-test ActorLibrary ${catkin_LIBRARIES})

2014-08-21 16:35:09 -0500 received badge  Editor (source)
2014-08-21 16:34:43 -0500 commented answer Linker error trying to build and run unit tests

Yeah, I'm not actually including a cpp, was just a typo. I don't think I am creating a library called my_package in my CMakelist.txt. Here is the full CMakelist.txt

2014-08-21 16:30:46 -0500 edited question Linker error trying to build and run unit tests

I am getting an error from the linker when I attempt to run catkin_make run_tests_my_package`

The error I get is: /usr/bin/ld: cannot find -lmy_package collect2: error: ld returned 1 exit status

Under testing in my CMakelist.txt I have the following: catkin_add_gtest(${PROJECT_NAME}-test test/utest.cpp) if(TARGET ${PROJECT_NAME}-test) target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) endif()

include_directories(include ${catkin_INCLUDE_DIRS})

Am I missing something? do I need to use add_executable in my CMakelist.txt?

Another thing to mention is my workspace layout, it's arranged as follows: my_package/ bin/ build/ src/ my_class.h my_class.cpp test/ utest.cpp world/ CMakelist.txt

and inside utext.cpp I am referencing my_class.h list this #include "my_package/my_class.h

Full CMakelist.txt