SDL_Window 未命名类型

Mar*_*ari 4 c++ sdl window

我正在使用 GNU/Linux、C++、SDL 1.3 我正在尝试为“Window”类编写代码。

#ifndef WINDOW_H
#define WINDOW_H

#include "SDL/SDL.h"
#include "SDL/SDL_video.h"
#include "../other/Logger.h"

using namespace std;

class Window {
    public:
        Window(int width, int height, string title);
        ~Window();

    private:
        static const string TAG;
        SDL_Window* window; 
        int width;
        int height;
};

#endif /* WINDOW_H */ 
Run Code Online (Sandbox Code Playgroud)

当我尝试编译时,出现此错误:

In file included from Window.cpp:1:0:
Window.h:15:3: error: ‘SDL_Window’ does not name a type.
Run Code Online (Sandbox Code Playgroud)

Ada*_*eld 7

SDL_Window是来自 SDL 2 的数据类型。如果您使用 SDL 1.x,则需要以不同方式编写代码。有关更多信息,请参阅迁移指南