SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)


Get the version of SDL that is linked against your program.


int SDL_GetVersion(SDL_version * ver);

Function Parameters

ver the SDL_version structure that contains the version information

Return Value

Returns 0 on success or a negative error code on failure; call SDL_GetError() for more information.


If you are linking to SDL dynamically, then it is possible that the current version will be different than the version you compiled against. This function returns the current version, while SDL_VERSION() is a macro that tells you what version you compiled with.

This function may be called safely at any time, even before SDL_Init().


This function is available since SDL 3.0.0.

Code Examples

SDL_version compiled;
SDL_version linked;

SDL_Log("We compiled against SDL version %u.%u.%u ...\n",
       compiled.major, compiled.minor, compiled.patch);
SDL_Log("But we are linking against SDL version %u.%u.%u.\n",
       linked.major, linked.minor, linked.patch);


CategoryAPI, CategoryVersion

[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.