I have a project in Qt Creator in Windows,When compiled I got this Error, I Googled a few, But I couldn't find the solution :
\application\src\helpers.cpp:99: error: call of overloaded 'QMatrix4x4(const qreal*&)' is ambiguous
QMatrix4x4 matrix(a);
^
the line that has error:
QMatrix4x4 matrix(a);so what should I do?
helpers.cpp corresponded to the error:
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "helpers.h"
#include <QMatrix4x4>
#include <QtGui>
Helpers :: Helpers()
{
}
Helpers :: ~Helpers()
{
}
//====================================================================
// Normalize
//====================================================================
void Helpers::normalize(qreal *a)
{
double b;
b = vlen(a);
a[0] /= b;
a[1] /= b;
a[2] /= b;
}
//====================================================================
// Length
//====================================================================
qreal Helpers::vlen(qreal *a)
{
return sqrt(a[0]*a[0] + a[1]*a[1] + a[2]*a[2]);
}
//====================================================================
// Cross product
//====================================================================
void Helpers::crossProduct(qreal *a, qreal *b, qreal *c)
{
c[0] = a[1]*b[2] - a[2]*b[1];
c[1] = a[2]*b[0] - a[0]*b[2];
c[2] = a[0]*b[1] - a[1]*b[0];
}
//====================================================================
// Invert 4x4 matrix (for visualiztion only)
//====================================================================
//commented by John
// pre start cooment
void Helpers::invertMatrix(const qreal *a, qreal *inva)
{
QMatrix4x4 matrix(a);
bool ok(true);
QMatrix4x4 inverse(matrix.transposed().inverted(&ok));
if(!ok) fprintf(stderr, "Error: Singular 4x4 matrix\n");
for(int i = 0; i < 16; ++i)
inva[i] = double(inverse.data()[i]);
}
//*/ pre end comment
This is all errors that I see,after lots of debugging... I think the problem maybe about command syntax format or libraries definition and usage or something else...