opengl - C - invalid use of non-lvalue array -
opengl - C - invalid use of non-lvalue array -
i have matrix struct:
typedef struct matrix { float m[16]; } matrix; when seek phone call function:
memcpy(m->m, multiplymatrices(m, &translation).m, sizeof(m->m)); i error @ compile time saying:
error: invalid utilize of non-lvalue array
multiplymatrices returns matrix.
i error if utilize gcc compile file object, if utilize g++ compile object no error.
i not sure error means, have feeling has array stored in matrix returned multiplymatrices.
if need see more code allow me know.
this code tutorial: opengl book chapter 4
p.s. maintain code strict iso/ansi, if there no other solution however, i'll have deal it.
edit: ended going creating temporary matrix copying array.
matrix tempmatrix; ... tempmatrix = multiplymatrices(m, &translation); memcpy(m->m, tempmatrix.m, sizeof(m->m));
the homecoming value of multiplymatrices() not lvalue (like homecoming value of function), means can't take address. evaluating array (including array fellow member of structure) implicitly takes address of first element, can't that.
you can, however, utilize simple assignment of containing struct:
*m = multiplymatrices(m, &translation); as long struct contains 1 element have shown, same.
c opengl
Comments
Post a Comment