自己写的程序中不停的出现两个问题:
1>.\face3d.cpp(8) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const QVector3d' (or there is no acceptable conversion)
1> f:\corn\qreadobj\vector3d.h(38): could be 'QVector3d QVector3d::operator =(QVector3d &)'
1> while trying to match the argument list '(QVector3d, const QVector3d)'
1>scene3d.cpp
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(481) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const QFace3d' (or there is no acceptable conversion)
1> f:\corn\qreadobj\face3d.h(21): could be 'QFace3d QFace3d::operator =(QFace3d &)'
1> while trying to match the argument list '(QFace3d, const QFace3d)'
1> d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(473) : while compiling class template member function 'void QVector<T>::append(const T &)'
1> with
1> [
1> T=QFace3d
1> ]
1> f:\corn\qreadobj\group3d.h(13) : see reference to class template instantiation 'QVector<T>' being compiled
1> with
1> [
1> T=QFace3d
1> ]
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(474) : error C2558: class 'QVertex3d' : no copy constructor available or copy constructor is declared 'explicit'
1> d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(473) : while compiling class template member function 'void QVector<T>::append(const T &)'
1> with
1> [
1> T=QVertex3d
1> ]
1> f:\corn\qreadobj\scene3d.h(16) : see reference to class template instantiation 'QVector<T>' being compiled
1> with
1> [
1> T=QVertex3d
1> ]
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(479) : error C2558: class 'QVertex3d' : no copy constructor available or copy constructor is declared 'explicit'
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(474) : error C2558: class 'QVector3d' : no copy constructor available or copy constructor is declared 'explicit'
1> d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(473) : while compiling class template member function 'void QVector<T>::append(const T &)'
1> with
1> [
1> T=QNormal
1> ]
1> f:\corn\qreadobj\scene3d.h(17) : see reference to class template instantiation 'QVector<T>' being compiled
1> with
1> [
1> T=QNormal
1> ]
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(479) : error C2558: class 'QVector3d' : no copy constructor available or copy constructor is declared 'explicit'
1>d:\qt\include\qtcore\../../src/corelib/tools/qvector.h(481) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'const QNormal' (or there is no acceptable conversion)
1> f:\corn\qreadobj\vector3d.h(38): could be 'QVector3d QVector3d::operator =(QVector3d &)'
1> while trying to match the argument list '(QNormal, const QNormal)'
但是error中提示的复制构造函数和赋值操作符我明明已经在程序中定义了啊,怎么就是说没定义呢... 如下:
QVector3d QVector3d::operator =(QVector3d &vector3d)
{
m_x = vector3d.m_x;
m_y = vector3d.m_y;
m_z = vector3d.m_z;
return *this;
}
QFace3d QFace3d::operator =(QFace3d &face)
{
v0 = face.v0;
v1 = face.v1;
v2 = face.v2;
m_Normal = face.m_Normal;
}
请高手指点~