I've run into a problem that's really annoying and bothering me. This is the code:
block.hpp:
#pragma once
#include <iostream>
#include <SDL2/SDL.h>
#include "../global/global.hpp"
class Block{
SDL_Texture* texture;
SDL_Rect position;
public:
void setTexture(SDL_Texture* _texture);
void setPosition(SDL_Rect _position);
void render();
void destroy();
};
block.cpp:
#include "block.hpp"
void Block::setTexture(SDL_Texture* _texture){
texture = _texture;
}
void Block::setPosition(SDL_Rect _position){
position = _position;
}
void Block::render(){
SDL_RenderCopy(g_renderer,texture,nullptr,&position);
}
solid.hpp:
#pragma once
#include "block.hpp"
class Solid : public Block{
public:
Solid();
void setPosition(SDL_Rect _position);
void render();
};
solid.cpp:
#include "solid.hpp"
Solid::Solid(){
Block::setTexture(g_assets.textures["cegla"]);
}
void Solid::setPosition(SDL_Rect _position){
Block::setPosition(_position);
}
void Solid::render(){
Block::render();
}
Error:
In file included from src/block/../global/../block/blocks.hpp:3,
from src/block/../global/../map.hpp:8,
from src/block/../global/../assetmanager.hpp:9,
from src/block/../global/global.hpp:6,
from src/block/block.hpp:6,
from src/block/block.cpp:1:
src/block/../global/../block/solid.hpp:5:27: error: expected class-name before ‘{’ token
5 | class Solid : public Block{
Please help.I don't know what could be the reason, I tried replacing #include "block.hpp" with class Block, nothing helped