Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Solved

Posted on 2011-03-20

Hi Experts,

I have this function:

Vector Vector::operator *(Matrix &m) // return MatrixMulVector(this, m)

{

return (m * (*this));

}

where Vector:

Vector() { Set(0, 0, 0); }

Vector(float _x, float _y, float _z) { Set(_x, _y, _z); }

Vector(Vector &v) { Set(v.x, v.y, v.z); }

and Matrix:

Matrix() { memset(p,0,sizeof(float)*9); } // nullify matrix

Matrix( float xx, float xy, float xz,

float yx, float yy, float yz,

float zx, float zy, float zz) { Set(xx, xy, xz, yx, yy, yz, zx, zy, zz); } // construct matrix from 9 floats

Matrix(float ax, float ay, float az) { SetAng(ax, ay, az); } // construct matrix form 3 angles

Matrix(Matrix &m) { memcpy(p, m.p, sizeof(float)*9); }

My problem is that I can't compile it in QT 4.7 for Linux. However, it works without any problem in Visual Studio.

In QT I get this error:

no matching function for call to 'Vector::Vector(Vector)'

candidates are: Vector::Vector(Vector&)

Can someone tell me what should I change to create the equivalent of this function in QT ?

Thanks,

Peter

I have this function:

Vector Vector::operator *(Matrix &m) // return MatrixMulVector(this, m)

{

return (m * (*this));

}

where Vector:

Vector() { Set(0, 0, 0); }

Vector(float _x, float _y, float _z) { Set(_x, _y, _z); }

Vector(Vector &v) { Set(v.x, v.y, v.z); }

and Matrix:

Matrix() { memset(p,0,sizeof(float)*9

Matrix( float xx, float xy, float xz,

float yx, float yy, float yz,

float zx, float zy, float zz) { Set(xx, xy, xz, yx, yy, yz, zx, zy, zz); } // construct matrix from 9 floats

Matrix(float ax, float ay, float az) { SetAng(ax, ay, az); } // construct matrix form 3 angles

Matrix(Matrix &m) { memcpy(p, m.p, sizeof(float)*9); }

My problem is that I can't compile it in QT 4.7 for Linux. However, it works without any problem in Visual Studio.

In QT I get this error:

no matching function for call to 'Vector::Vector(Vector)'

candidates are: Vector::Vector(Vector&)

Can someone tell me what should I change to create the equivalent of this function in QT ?

Thanks,

Peter

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Title | # Comments | Views | Activity |
---|---|---|---|

How to mimic the following Windows API, GetLogicalDrives(), on Ubuntu Linux 15.10 using a series of C# Mono functions? | 12 | 152 | |

C++ get user from AD (VS6) | 7 | 72 | |

getting a fire fox page (view page source ) in c++ | 6 | 42 | |

Problem with SqlConnection | 4 | 168 |

Join the community of 500,000 technology professionals and ask your questions.