1
我有以下代码:预期类型说明符错误GCC
在文件 “的defs.h”
namespace ABCD
{
template < typename T >
class TPixelSum_TraitFor
{
public:
typedef double AccumType;
};
template <>
class TPixelSum_TraitFor<MonochromeImage::PixelType>
{
public:
typedef /*unsigned*/ long AccumType;
};
}
,并在文件中 “GraphicLibrary.h”
#include "Defs.h"
using namespace ABCD;
using namespace std;
template < typename T, typename ACC_TRAIT = TPixelSum_TraitFor<T> >
class SumImage : public TImageProcessor<T>
{
public:
typedef typename ACC_TRAIT::AccumType AccumType;
private:
AccumType fSum;
};
和我收到以下错误
'T之前的预期类型说明符PixelSum_TraitFor”
预期 '>' 前 'TPixelSum_TraitFor'
在线路
模板<类型名称T,类型名ACC_TRAIT = TPixelSum_TraitFor < T>>
的代码是用g ++编译4.8.1
Upvoted的答案,我也无法重现此错误。 – Ali
这可能是由于未知类型的注释。但我只是在猜测,GCC是我不太熟悉的东西。 –
那么,我们不应该猜测,他应该发布一个[SSCCE](http://sscce.org/),以便我们可以诊断问题。我也投票结束这个问题。 – Ali