gpt4 book ai didi

c++ - G++ 将返回结构的函数原型(prototype)混淆为结构初始值设定项

转载 作者:行者123 更新时间:2023-11-28 07:01:52 26 4
gpt4 key购买 nike

编译项目时出现以下错误:

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);

注意末尾的分号。

关于c++ - G++ 将返回结构的函数原型(prototype)混淆为结构初始值设定项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22315449/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com