Ask Your Question
0

Exporting action client as class library to QtCreator

asked 2017-01-19 10:09:52 -0600

jdcarp gravatar image

updated 2017-01-19 13:22:20 -0600

I've written an action client as a class, which contains several member functions that I hope to use as an API for a backend to a GUI. In this design, the GUI would instantiate the action client class and use its member functions to send goals to an independently running action server.

The GUI is written in QT, so I built my action client class as a static library and I've linked it with catkin_LIBRARIES. After adding my class library as an external library in QT, I get a linker error: /usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'

Upon seeing this I went back to my CMakeLists.txt for my package and tried to include Boost::system.

I added to CMakeLists.txt:

find_package(Boost REQUIRED COMPONENTS system filesystem thread)
include_directories( include
  ${catkin_INCLUDE_DIRS}
  ${Boost_INCLUDE_DIRS}
)
add_library(gui_translator_client STATIC 
  src/gui_translator_client.cpp
)
target_link_libraries(gui_translator_client
  ${catkin_LIBRARIES}
  ${Boost_LIBRARIES}
 )

This still did not correct the linker error when including the library in Qt, so I decided to explicitly link my class library with Boost_SYSTEM_LIBRARY and BOOST_FILESYSTEM_LIBRARIES.

target_link_libraries(gui_translator_client
  ${catkin_LIBRARIES}
  ${Boost_LIBRARIES}
  ${Boost_SYSTEM_LIBRARY}}
  ${Boost_FILESYSTEM_LIBRARIES}
)

This prevented my class library from building. Specifically, the line $(Boost_SYSTEM_LIBRARY} produces a build error:

No rule to make target `/usr/lib/x86_64-linux-gnu/libboost_system.so}'

My package.xml has build_depend and run_depend tags for boost and boost_system. libboost_dev-all is installed to my machine.

Are these two build errors the same? Does anyone know how to resolve either?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-01-23 13:58:28 -0600

jdcarp gravatar image

This issue was solved by adding the -lboost_system library to QT Creator as an external library.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-01-19 10:09:52 -0600

Seen: 69 times

Last updated: Jan 23 '17