Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This is a linking problem (ie: libraries), not a problem with headers.

add_executable(generated_test orbit.c)
target_link_libraries(generated_test ${catkin_LIBRARIES})

You're not linking any of the kilo* libraries, which is why the compiler cannot resolve the symbols.

This is a linking problem (ie: libraries), not a problem with headers.

add_executable(generated_test orbit.c)
target_link_libraries(generated_test ${catkin_LIBRARIES})

You're not linking any of the kilo* libraries, which is why the compiler cannot resolve the symbols.

You'll have to add one of the sim or headless libs to the target_link_library(..) statement that you already have.


However: note that you are compiling C here: ROS has no client library for C, so you'll have to write something in C++. If/when you do, know that C++ mangles names, so you'll have to take care of that as well. You should get sufficient results if you search for c++ link c library with your favourite search engine.

This is a linking problem (ie: libraries), not a problem with headers.

add_executable(generated_test orbit.c)
target_link_libraries(generated_test ${catkin_LIBRARIES})

You're not linking any of the kilo* libraries, which is why the compiler cannot resolve the symbols.

You'll have to add one of the sim or headless libs to the target_link_library(..) statement that you already have.


However: note that you are compiling C here: ROS has no client library for C, so you'll have to write something in C++. If/when you do, know that C++ mangles names, so you'll have to take care of that as well. You should get sufficient results if you search for c++ link c library with your favourite search engine.


Edit: some suggestions / questions:

  • /usr/local/lib should already be on the link path, and /usr/local/include should already be on the include path, so I don't believe you need to add those
  • putting /usr/local/include on the linker path seems rather strange to me: do you have libraries in that directory?
  • the same for /usr/local/lib on the include path: headers in a lib dir?
  • CMAKE_COMPILER_IS_GNUCXX is set if the compiler is g++, but -std=c99 is something for the C compiler. Should that be CMAKE_COMPILER_IS_GNUC in the conditional?

This is a linking problem (ie: libraries), not a problem with headers.

add_executable(generated_test orbit.c)
target_link_libraries(generated_test ${catkin_LIBRARIES})

You're not linking any of the kilo* libraries, which is why the compiler cannot resolve the symbols.

You'll have to add one (or both? I don't know these libraries) of the sim or headless libs to the target_link_library(..) statement that you already have.


However: note that you are compiling C here: ROS has no client library for C, so you'll have to write something in C++. If/when you do, know that C++ mangles names, so you'll have to take care of that as well. You should get sufficient results if you search for c++ link c library with your favourite search engine.


Edit: some suggestions / questions:

  • /usr/local/lib should already be on the link path, and /usr/local/include should already be on the include path, so I don't believe you need to add those
  • putting /usr/local/include on the linker path seems rather strange to me: do you have libraries in that directory?
  • the same for /usr/local/lib on the include path: headers in a lib dir?
  • CMAKE_COMPILER_IS_GNUCXX is set if the compiler is g++, but -std=c99 is something for the C compiler. Should that be CMAKE_COMPILER_IS_GNUC in the conditional?