gpt4 book ai didi

c++ - 'double' 之前的预期初始化程序

转载 作者:太空宇宙 更新时间:2023-11-04 15:09:55 25 4
gpt4 key购买 nike

这一行可能出现的错误是什么:

double bx;

bx 我定义普遍!但我在编译时遇到上述错误。即使是 float bx;我遇到了同样的错误。

周边代码为:

#include "header.h"
#include "ball_pad.h"
#include "pingpong.h"
#include "texture.h"
#include "3dsloader.h"


float A = 90.0f;
float B = 70.0f;
/**********************************************************
*
* VARIABLES DECLARATION
*
*********************************************************/

// The width and height of your window, change them as you like
int screen_width=640;
int screen_height=480;

// Absolute rotation values (0-359 degrees) and rotation increments for each frame
double rotation_x=0, rotation_x_increment=0.1;
double rotation_y=0, rotation_y_increment=0.05;
double rotation_z=0, rotation_z_increment=0.03;

// Absolute rotation values (0-359 degrees) and rotation increments for each frame
double translation_x=0, translation_x_increment=1.0;
double translation_y=0, translation_y_increment=0.05;
double translation_z=0, translation_z_increment=0.03;

// Flag for rendering as lines or filled polygons
int filling=1; //0=OFF 1=ON

//Now the object is generic, the cube has annoyed us a little bit, or not?
obj_type board,ball,pad_alongX,pad_alongY;

BALL ball1//,ball2,ball3;
double bx = 0;
double by = 0;
double bvx = 2.0;
double bvy = 2.0;
double radius = 5.0;
//ball2.bx = 0;ball2.by = 0;ball2.bvx = 2.0;ball2.bvy = 2.0;ball2.radius = 5.0;
//ball3.bx = 0;ball3.by = 0;ball3.bvx = 2.0;ball3.bvy = 2.0;ball3.radius = 5.0;

PADDLE pad1,pad2,pad3,pad4;
//pad1.px = 0;pad1.py = 0;pad1.pvx = 2.0;pad.pvy = 2.0;pad1.length = 25.0;pad1.width = 5.0;

最佳答案

你少了一个分号:

BALL ball1//,ball2,ball3;
double bx = 0;

应该是:

BALL ball1; //,ball2,ball3;
double bx = 0;

关于c++ - 'double' 之前的预期初始化程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3923019/

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