c++ - SDL_Window 没有命名类型

标签 c++ window sdl

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

#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 */ 

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

In file included from Window.cpp:1:0:
Window.h:15:3: error: ‘SDL_Window’ does not name a type.

最佳答案

SDL_Window 是来自 SDL 2 的数据类型。如果您使用的是 SDL 1.x,则需要以不同方式编写代码。查看Migration Guide获取更多信息。

关于c++ - SDL_Window 没有命名类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12695719/

相关文章:

C++ 友元运算符重载不编译

c++ - 根据 C++11 中的模板参数选择数组大小?

c++ - 为什么互斥锁与原子操作的不同之处在于前者是操作系统级别,后者是处理器级别?

C++从文本文件中读取,双行

c++ - Qt去掉标题栏

windows - 如何在 Powershell 中的 System.String 类型的字符串中添加值

c++ - 打开窗口时应用程序崩溃 qt

c++ - SDL2 : Fast Pixel Manipulation

C++:也许你知道这个陷阱?

c - 在 SDL 中,如果我重新渲染文本,是否需要释放表面?