gpt4 book ai didi

c++ - gazebo ros插件报错: Undefined symbols for architecture x86_64

转载 作者:行者123 更新时间:2023-11-28 05:38:30 25 4
gpt4 key购买 nike

我是 ROS 和 Gazebo 编程的新手。我正在尝试为安装在我的机器人模型上的激光器创建一个控制插件。

我在 MAC OS X 10.11.5 上使用 ROS indigo 和 gazebo 7.0

当我尝试使用标准“cmake”和“make”编译我的插件的 .cc 文件时,我的问题来了。

按照官方教程 ( http://gazebosim.org/tutorials/?tut=plugins_model ),我将 CMakeLists.txt 编写为:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

find_package(roscpp REQUIRED)
find_package(std_msgs REQUIRED)
include_directories(${roscpp_INCLUDE_DIRS})
include_directories(${std_msgs_INCLUDE_DIRS})

# Find Gazebo
find_package(gazebo REQUIRED)
include_directories(${GAZEBO_INCLUDE_DIRS})
link_directories(${GAZEBO_LIBRARY_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GAZEBO_CXX_FLAGS}")



# Build our plugin
add_library(velodyne_plugin SHARED velodyne_plugin.cc)
target_link_libraries(velodyne_plugin ${GAZEBO_libraries} ${catkin_LIBRARIES} ${Boost_LIBRARIES} ${roscpp_LIBRARIES})

我认为问题可能源于库的依赖性。

“cmake”命令似乎运行良好,而“make”返回以下输出:

[ 50%] Linking CXX shared library libvelodyne_plugin.dylib
Undefined symbols for architecture x86_64:
"sdf::Console::ColorMsg(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, unsigned int, int)", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
bool sdf::Param::Get<double>(double&) const in velodyne_plugin.cc.o
"sdf::Console::Instance()", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
bool sdf::Param::Get<double>(double&) const in velodyne_plugin.cc.o
sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [30]>(char const (&) [30]) in velodyne_plugin.cc.o
sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [3]>(char const (&) [3]) in velodyne_plugin.cc.o
sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [29]>(char const (&) [29]) in velodyne_plugin.cc.o
sdf::Console::ConsoleStream& sdf::Console::ConsoleStream::operator<<<char [15]>(char const (&) [15]) in velodyne_plugin.cc.o
...
"sdf::Element::GetElement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
"sdf::Element::GetAttribute(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
"sdf::Element::HasElementDescription(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
"gazebo::event::Connection::Connection(gazebo::event::Event*, int)", referenced from:
gazebo::event::EventT<void (gazebo::common::UpdateInfo const&)>::Connect(boost::function<void (gazebo::common::UpdateInfo const&)> const&) in velodyne_plugin.cc.o
"gazebo::event::Connection::~Connection()", referenced from:
void boost::checked_delete<gazebo::event::Connection>(gazebo::event::Connection*) in velodyne_plugin.cc.o
"gazebo::event::Events::worldUpdateBegin", referenced from:
boost::shared_ptr<gazebo::event::Connection> gazebo::event::Events::ConnectWorldUpdateBegin<boost::_bi::bind_t<void, boost::_mfi::mf0<void, gazebo::VelodynePlugin>, boost::_bi::list1<boost::_bi::value<gazebo::VelodynePlugin*> > > >(boost::_bi::bind_t<void, boost::_mfi::mf0<void, gazebo::VelodynePlugin>, boost::_bi::list1<boost::_bi::value<gazebo::VelodynePlugin*> > >) in velodyne_plugin.cc.o
"gazebo::common::Time::Time(double)", referenced from:
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
"gazebo::common::Time::Time()", referenced from:
gazebo::VelodynePlugin::VelodynePlugin() in velodyne_plugin.cc.o
"gazebo::common::Time::~Time()", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
gazebo::VelodynePlugin::~VelodynePlugin() in velodyne_plugin.cc.o
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
"gazebo::common::Time::operator=(gazebo::common::Time const&)", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
"gazebo::common::Time::operator+=(gazebo::common::Time const&)", referenced from:
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
"ignition::math::IndexException::IndexException()", referenced from:
ignition::math::Vector3<double>::operator[](unsigned long) const in velodyne_plugin.cc.o
ignition::math::Vector2<int>::operator[](unsigned long) const in velodyne_plugin.cc.o
ignition::math::Vector2<double>::operator[](unsigned long) const in velodyne_plugin.cc.o
"sdf::Element::HasElement(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
"sdf::Element::GetElementImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
"sdf::Element::GetElementDescription(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const", referenced from:
double sdf::Element::Get<double>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in velodyne_plugin.cc.o
"gazebo::common::Time::Double() const", referenced from:
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
"gazebo::common::Time::operator-(gazebo::common::Time const&) const", referenced from:
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
"gazebo::physics::Base::GetWorld() const", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
"gazebo::physics::Model::GetJointCount() const", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
"gazebo::physics::Model::GetJoints() const", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
"gazebo::physics::World::GetSimTime() const", referenced from:
gazebo::VelodynePlugin::Load(boost::shared_ptr<gazebo::physics::Model>, std::__1::shared_ptr<sdf::Element>) in velodyne_plugin.cc.o
gazebo::VelodynePlugin::UpdateChild() in velodyne_plugin.cc.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libvelodyne_plugin.dylib] Error 1
make[1]: *** [CMakeFiles/velodyne_plugin.dir/all] Error 2
make: *** [all] Error 2

有人可以帮助我吗?

谢谢,

彼得罗

最佳答案

尝试用 GAZEBO_LIBRARIES 替换 target_link_libraries: GAZEBO_libraries。

关于c++ - gazebo ros插件报错: Undefined symbols for architecture x86_64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37674158/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com