我打算同时使用SDL_GetKeyboardState
和SDL_Overlay
,但似乎存在冲突。
#include <stdio.h>
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
int main()
{
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
SDL_Overlay *bmp;
printf("hello world!");
}
编译:
gcc -c main.cpp
当标题的顺序是:
#include <SDL/SDL.h>
#include <SDL2/SDL.h>
error: ‘SDL_GetKeyboardState’ was not declared in this scope
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
^
或
#include <SDL2/SDL.h>
#include <SDL/SDL.h>
error: ‘SDL_Overlay’ was not declared in this scope
SDL_Overlay *bmp;
^
甚至添加
#include <SDL2/SDL_video.h>
无法解决问题。
我应该添加哪个标头才能使用SDL_Overlay
?