обнаружен многократно используемый символ, как исправить
Вот мои файлы: tPointt.h
#include <windows.h>
#include <glut.h>
#include <Math.h>
#include <vector>
#include <array>
#include <vector>
#include <ctime>
GLfloat ballXMax, ballXMin, ballYMax, ballYMin;
float ballRadius = 0.007f;
float PI = 3.14159265f;
class tPoint {
public:
float x;
float y;
float R;
int r;
int g;
int b;
float speedX;
float speedY;
int move;
tPoint();
void Draw();
void move_point();
};
tPointt.cpp
void tPoint::Draw() {
glBegin(GL_TRIANGLE_FAN);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3ub(r, g, b);
glVertex2f(x, y);
for (int angle = 0; angle <= 360; angle += 10) {
float _x = R * cos(angle * PI / 180);
float _y = R * sin(angle * PI / 180);
glColor3ub(r, g, b);
glVertex2f(x + _x, y + _y);
}
glEnd();
}
void tPoint::move_point() {
if (move == 1) {
x += speedX;
y += speedY;
if (x > ballXMax) {
x = ballXMax;
speedX = -speedX;
}
else if (x < ballXMin) {
x = ballXMin;
speedX = -speedX;
}
if (y > ballYMax) {
y = ballYMax;
speedY = -speedY;
}
else if (y < ballYMin) {
y = ballYMin;
speedY = -speedY;
}
}
else {
x += rand() % 100 / 1000.f * pow(-1, rand() % 2);
y += rand() % 100 / 1000.f * pow(-1, rand() % 2);
if (x > ballXMax) {
x = ballXMax;
speedX = -speedX;
}
else if (x < ballXMin) {
x = ballXMin;
speedX = -speedX;
}
if (y > ballYMax) {
y = ballYMax;
speedY = -speedY;
}
else if (y < ballYMin) {
y = ballYMin;
speedY = -speedY;
}
}
}
main.cpp
extern GLfloat ballXMax, ballXMin, ballYMax, ballYMin;
extern float PI;
void reshape(GLsizei width, GLsizei height) {
// Compute aspect ratio of the new window
if (height == 0) height = 1; // To prevent divide by 0
GLfloat aspect = (GLfloat)width / (GLfloat)height;
// Set the viewport to cover the new window
glViewport(0, 0, width, height);
// Set the aspect ratio of the clipping area to match the viewport
glMatrixMode(GL_PROJECTION); // To operate on the Projection matrix
glLoadIdentity(); // Reset the projection matrix
if (width >= height) {
clipAreaXLeft = -1.0 * aspect;
clipAreaXRight = 1.0 * aspect;
clipAreaYBottom = -1.0;
clipAreaYTop = 1.0;
}
else {
clipAreaXLeft = -1.0;
clipAreaXRight = 1.0;
clipAreaYBottom = -1.0 / aspect;
clipAreaYTop = 1.0 / aspect;
}
gluOrtho2D(clipAreaXLeft, clipAreaXRight, clipAreaYBottom, clipAreaYTop);
ballXMin = clipAreaXLeft + ballRadius;
ballXMax = clipAreaXRight - ballRadius;
ballYMin = clipAreaYBottom + ballRadius;
ballYMax = clipAreaYTop - ballRadius;
}
Вставил функции, в которых используются повторяющиеся переменные, как исправить можно? Писал extern в каждом файле, не особо помогло
