小编Tal*_*r T的帖子

循环依赖:无法删除不完整的类型

我不明白为什么我得到这个编译错误:

error C2027: use of undefined type 'GameState'
note: see declaration of 'GameState'
error C2338: can't delete an incomplete type warning C4150: deletion of pointer to incomplete type 'GameState'; no destructor called
Run Code Online (Sandbox Code Playgroud)

这是相关代码:

#pragma once
#include <SFML\Graphics.hpp>
#include "SpawnManager.h"
#include "Resource.h"
#include <stack>
#include <memory>
class GameState;

class Controller
{
public:
    Controller();
    void run();
    void setPlayerScore(unsigned score);
    sf::RenderWindow& getWindow() { return m_window; }
    void addState(const States& state);
    void changeState(const States& state);
    GameState* getState() const;
    void popState();
    void add_state(const States& type, …
Run Code Online (Sandbox Code Playgroud)

c++ oop smart-pointers

4
推荐指数
1
解决办法
2651
查看次数

标签 统计

c++ ×1

oop ×1

smart-pointers ×1