Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.cpp

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.cpp"my_package/my_class.h

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

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