我试图构建我的朋友的QT应用程序的OS X版本,他在Windows和Linux上构建了这个应用程序。我们都使用g ++。我正在使用gcc 4.2.1。不幸的是,我不知道他在构建应用程序时使用了什么版本(很早以前)。非类型模板参数错误('x'不是类型)
任何人都可以揭示为什么我收到错误一些轻:
../../../src/dbapi/dbcore/node.h:24: error: 'dimensions' is not a type
编译下面的代码时:
Node.h:
template<class T,const unsigned int dimensions>
class EXPORT_DBCORE Node : public Transform<T,dimensions>
{
public:
Node(Id id,
QString& name,
QString& text = "",
// ************** Offending line: ***************
Vector<T,dimensions> position = Vector<T,dimensions>(),
Quaternion<T> rotation = Quaternion<T>())
: Transform<T,dimensions>(position, rotation)
, mId(id)
, mName(name)
, mText(text)
{
}
private:
...
};
Vector.h:
template<class T,const unsigned int dimensions>
class EXPORT_DBCORE Vector
{
public:
//! Default Constructor
Vector()
{
mpArray = new T[dimensions];
for(int i = 0; i < dimensions; i++)
{
mpArray[i] = 0;
}
}
...
谢谢。
编辑:对不起,如果不清楚哪一行是24号。它由Node.h摘录中的“Offending line”注释表示。
你能否给我们提示代码段中的哪一行是第24行? –
你在'Node'头文件中包含了'Vector'头文件吗?当Qt和标准库都有良好的工作类时,为什么要使用自己的矢量类? –
是gcc 4.2.1最新的编译器吗?也许如果你切换到最近版本的铿锵声,它会工作,否则你会得到更好的错误信息。 – bames53