I know the question was already asked elsewhere, but I keep not getting what's wrong here. Maybe I'm doing something wrong because the two arrays are inside a structure.
(EDIT: I am getting the structure from some other code, and I cannot change it)
I'm trying to pass two arrays of float to a function, and then saving back the result of manipulation in the first array.
core.h:
typedef struct{
//other stuff
float m_vector[16];
} structure_t;
class CoreClass{
private:
structure_t s1;
structure_t s2;
float *MyFunction(const float *vDest, const float *vNew);
}
core.cpp:
#include "core.h"
#include "another_file.h"
void anotherFunction(){
//....
s1.m_vector = MyFunction(s1.m_vector, s2.m_vector); //error here
//....
}
float *CoreClass::MyFunction(const float *vDest, const float *vNew){
return yet_another_function(vDest, vNew);
}
When I'm calling the function, however, I'm getting this error:
error: incompatible types in assignment of ‘float*’ to ‘float [16]’
For completeness, here is the function I'm calling, though it does not seem to do any trouble at compile time:
another_file.h
static __inline float *yet_another_function(const float *vDest, const float *vNew){
float *tmp = new float[16];
//tmp = matrix multiplication (vDest * vNew)
for(int i=0; i<4; i++)
for(int j = 0; j<4;j++)
for(int k = 0; 4; k++)
tmp[i + j*4] += vDest[i + k*4] * vNew[k + j*4];
return tmp;
}