【发布时间】:2014-01-08 15:40:53
【问题描述】:
我正在使用 PCL(点云库)。我创建了一个继承自 PCL 模板类 (pcl::SpinImageEstimation) 的类 (myPCL_SI)。我创建了另一个普通类 (myPCL),它创建了一个 myPCL_SI 对象。
我这样做是因为我需要从pcl::SpinIMageEstimation 访问受保护的方法。如果有人知道更好的解决方案,请告诉我。
好的,我的问题是当我尝试创建myPCL_SI 对象时,编译器给了我这个错误:
error: ‘spinImage’ was not declared in this scope
error: template argument 1 is invalid
error: template argument 3 is invalid
我的代码是这个:
myPCL 类(仅我的方法)
void myPCL::calcSpinImage(){
myPCL_SI<pcl::PointXYZ, pcl::Normal, pcl::Histogram<153>> spinImage;
// doing more things...
}
myPCL_SI 类(标头)
#ifndef MYPCL_SI_H
#define MYPCL_SI_H
// a lot of includes...
using namespace pcl;
template <typename PointInT, typename PointNT, typename PointOutT>
class myPCL_SI : public SpinImageEstimation<PointInT, PointNT, PointOutT>
{
public:
myPCL_SI();
void compute(PointCloud<PointXYZ>::Ptr cloud);
};
#include "mypcl_si.cpp"
#endif // MYPCL_SI_H
myPCL_SI 类 (impl)
template <typename PointInT, typename PointNT, typename PointOutT>
myPCL_SI<PointInT, PointNT, PointOutT>::myPCL_SI()
{
}
非常感谢! :D
【问题讨论】:
标签: c++ templates inheritance compiler-errors