2012-10-02 60 views
1

我正在使用GNU/Linux,C++,SDL 1.3 我正在嘗試編寫「Window」類的代碼。SDL_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 */ 

當我嘗試編譯我得到這個錯誤:

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

您是否在SDL.h中找到了'SDL_Window'聲明? – halex

+0

@halex,no。我只是試圖遵循這個例子:http://wiki.libsdl.org/moin.cgi/SDL_CreateWindow#Code_Examples。事情是,我沒有SDL2。 –

+0

@ l19在這種情況下,請查找SDL 1的教程或安裝SDL 2 – nos

回答

3

SDL_Window是SDL 2.數據類型,如果您使用SDL 1.x中,你需要以不同的方式編寫代碼。有關更多信息,請參閱Migration Guide