#include <stdio.h>#include <SDL.h>#undef main
int main()
{printf("Hello World!\n");SDL_Window *window = NULL; // 声明窗口SDL_Init(SDL_INIT_VIDEO); // 初始化SDL// 创建SDL Windowwindow = SDL_CreateWindow("Basic Window",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,640,480,SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);if(!window) // 检测是否创建成功{printf("Can't create window, err:%s\n", SDL_GetError());return 1;}SDL_Delay(10000); // 延迟10000msSDL_DestroyWindow(window); // 消耗窗口SDL_Quit(); // 释放资源return 0;
}
获取更多Linux C/C++资料