编译项目时,出现以下错误:
drawplant.h: In function 'Matrix3f current_matrix()':
drawplant.h:26:1: error: only constructors take member initializers
Matrix3f mmmult(Matrix3f, Matrix3f);
这是drawplant.h:
#ifndef _DRAWPLANT_H_
#define _DRAWPLANT_H_
/* Functions implemented in drawplant.cpp */
#define PI 3.14159265358
struct Vector3f{
GLdouble v[4];
} typedef Vector3f;
struct Matrix3f{
GLdouble m[16];
} typedef Matrix3f;
extern int depth;
void drawPlant();
void push();
void pop();
//void rotate(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
//void translate(GLdouble, GLdouble, GLdouble);
//void scale(GLdouble, GLdouble, GLdouble);
Matrix3f current_matrix(void):
Matrix3f mmmult(Matrix3f, Matrix3f);
Vector3f mvmult(Matrix3f, Vector3f);
#endif /* _DRAWPLANT_H_ */
最佳答案
尝试改变
Matrix3f current_matrix(void):
至
Matrix3f current_matrix(void);
注意最后的分号。