'双倍'之前的预期初始化程序

时间:2010-10-13 11:16:47

标签: c++

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

double bx;

bx我定义普遍!但我在编译时遇到上述错误.Even for 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;

2 个答案:

答案 0 :(得分:7)

你错过了一个分号:

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

应该是:

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

答案 1 :(得分:1)

在此声明之前的最后一个声明中可能缺少分号符号。