變量,我想請教一下在C++中的typedef變量的typedef在C++
好了,我現在正在使用PCL,我想代碼分離到的.h和.cpp
,這裏是我的.h文件
template <typename PointType>
class OpenNIViewer
{
public:
typedef pcl::PointCloud<PointType> Cloud;
typedef typename Cloud::ConstPtr CloudConstPtr;
...
...
CloudConstPtr getLatestCloud();
...
...
};
然後getLatestCloud()對其他.cpp文件
template <typename PointType>
CloudConstPtr OpenNIViewer<PointType>::getLatestCloud()
{
...
}
然後我得到了C4430的定義錯誤,因爲它不承認返回類型CloudConstPtr
抱歉愚蠢的問題:d
啊,謝謝你的回答,反正我發現模板類不應該分開來的.h和.cpp 我應該把他們都在一個單一的.h代替:d – 2012-03-24 07:50:43
@RezaAdhityaSaputra:是的。把它們放在單個'.h'文件中 – Nawaz 2012-03-24 07:54:36