错误:调用纯虚方法 - 在没有活动异常的情况下终止调用[关闭]

问题描述 投票:0回答:0

我的 Accueil.hpp

#include <string>
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace std;
using namespace sf;

class Accueil{

    public:
        Accueil();
        ~Accueil();
        void load_shapes();
        void drawScreens(RenderWindow* window);
        
    protected:
        vector<Texture*> textures;
        vector<Sprite*> sprites;
        vector<CircleShape*> circles;
        vector<RectangleShape*> rects;
        vector<Font*> fonts;
        vector<Text*> txts;
        RenderWindow window;

};

我的 main.cpp

#include "Accueil.hpp"
#include <SFML/Graphics.hpp>

using namespace std;
using namespace sf;

int main(int argc, char* argv[]){
    RenderWindow win;
    Accueil* a = new Accueil();
    a->load_shapes();
    a->drawScreens(&win);
    return 0;
}

我收到以下错误:

pure virtual method called
terminate called without an active exception
Aborted (core dumped)

它从哪里来的?我没有将析构函数或构造函数用作虚拟函数,所以我不明白。预先感谢您的回答,祝您有美好的一天。我使用 SFML 和 C++ 编写视频游戏的欢迎屏幕代码。

c++ sfml
© www.soinside.com 2019 - 2024. All rights reserved.