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
据我所知,这是由编译器无法找到Rectangle类引起的,尽管IDE能够(因此没有其他错误)。
我尝试过的事情:
答案 0 :(得分:0)
该问题与链接具有从未显示的错误的对象的错误有关。我对一些标头进行了重新排序,发现了一些以前从未显示过的警告,并且在修复了这些警告之后,弹出了两个错误,当这些错误被修复后,代码可以很好地编译。