我正在尝试为激光设备安装一个“工具箱”(http://sicktoolbox.sourceforge.net/docs/sicktoolbox-quickstart.pdf),当我尝试构建它时收到此消息(第 5.2 节中的命令):
Building Sick LMS mex...
Building with 'g++'.
/home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMSBufferMonitor.cc
:131:48: error: declaration of ‘SickToolbox::SickLMSBufferMonitor::~SickLMSBufferMonitor() throw
(SickToolbox::SickThreadException)’ has a different exception specifier
In file included from /home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMS.hh:
24:0,from /home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMSBufferMonitor.cc:24:0,
/home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMSBufferMonitor.hh:44:5: error:
from previous declaration ‘SickToolbox::SickLMSBufferMonitor::~SickLMSBufferMonitor() noexcept (true)’
./build_mex: Build failed!
任何关于如何解决此问题的线索都值得感激。一个问题是,这个工具箱是几年前编写的,当时 Ubuntu 7 很流行,所以我认为这可能是问题的一部分!
提前致谢
答案1
在以下位置有 SickToolbox::SickLMSBufferMonitor::~SickLMSBufferMonitor() 的双重声明
/home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMS.hh - 第 24 行
另一个
/home/ark3420/SICK/sicktoolbox-1.0.1/matlab/../c++/drivers/lms/sicklms-1.0/SickLMSBufferMonitor.hh - 第 44 行
打开编辑器查看这两个文件,看看哪个更合理。您可以尝试取消注释一个声明,看看是否可行。或者联系源代码的作者。
答案2
因此它看起来像这样:
SickLMSBufferMonitor::~SickLMSBufferMonitor( ) { }
被替换为
SickLMSBufferMonitor::~SickLMSBufferMonitor( ) throw (SickToolbox::SickThreadException) { }
来解决这个问题。