Rectangle.h
#pragma once
#ifndef RECTANGLE_H
#define RECTANGLE_H
#include "Input.h” //Necessary to prevent errors (defines)
class Rectangle {
public:
Rectangle();
~Rectangle();
static bool rectIsColliding(Rectangle r1, Rectangle r2);
float getX();
float getY();
float getWidth();
float getHeight();
void setX(float);
void setY(float);
void setWidth(float);
void setHeight(float);
void setPos(float, float);
void setSize(float, float);
void translate(float, float);
void scale(float, float);
void flip();
private:
float x;
float y;
float width;
float height;
};
#endif
Player.h:
#pragma once
#ifndef PLAYER_H
#define PLAYER_H
#include "Input.h” //Necessary to prevent errors (defines)
#include "Rectangle.h"
class Player {
public:
Player();
~Player();
void update(); //Run on every tick (physics, motion, etc.)
void render(); //Run on every render (graphics, image, etc.)
private:
Rectangle hitbox; //C3646: "hitbox" unknown ovveride specifier
//C4430: missing type specifier - int assumed. Note: C++ does not support default-int
float xPos = 0, yPos = 0; //Position
float vX = 0, vY = 0; //Velocity
Direction direction; //Direction for graphics
unsigned char *image; //Image pointer
int width, height, comp; //Image dimentions
unsigned int texture, VBO, VAO, EBO; //Buffers
int vertexShader; //Vertex shader pointer
int fragmentShader; //Fragment shader pointer
unsigned int shaderProgram; //Dual shader program pointer
};
#endif
From what I understand, this is caused by the compiler not being able to find the Rectangle class, despite the IDE being able to (hence why there were no other errors).
Things I have tried:
- Moving around the Rectangle include in Player.h
- Putting the Rectangle include in stdafx.h
- Copying the Rectangle code (Rectangle.h & Rectangle.cpp) into Player.h
- Changing the C++ version