I'm trying to update some C++ code in a custom version of DOSBox from SDL1.2 to SDL2. The lines that have me baffled are these:
SDL_SysWMinfo systemInfo;
SDL_VERSION(&systemInfo.version);
if(SDL_GetWindowWMInfo(window, &systemInfo) !=1) return;
if (!::OpenClipboard(systemInfo.info.win.window)) return;
SDL_GetWindowWMInfo is defined in SDL_syswm.h this way:
typedef struct SDL_SysWMinfo SDL_SysWMinfo;
extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, SDL_SysWMinfo * info);
When I try to build in Visual Studio 2010, I get this error, thrown by the third line in the code above:
1> sdlmain.cpp
1>..\src\gui\sdlmain.cpp(2966): error C2065: 'window' : undeclared identifier
I think the answer is here:
https://gamedev.stackexchange.com/questions/82068/how-can-i-obtain-a-window-handle-in-sdl-2-0-3
but I'm a beginner and can't figure out how to adapt that to my own code. If anyone is willing to help out a complete beginner, I'll be grateful.
Solved by adding the first line (as it explains clearly in the SDL wiki):