Macro to determine SDL version program was compiled against.
Defined in SDL_version.h
#define SDL_VERSION(x) \
{ \
(x)->major = SDL_MAJOR_VERSION; \
(x)->minor = SDL_MINOR_VERSION; \
(x)->patch = SDL_PATCHLEVEL; \
}
x | A pointer to a SDL_version struct to initialize. |
This macro fills in a SDL_version structure with the version of the library you compiled against. This is determined by what header the compiler uses. Note that if you dynamically linked the library, you might have a slightly newer or older version at runtime. That version can be determined with SDL_GetVersion(), which, unlike SDL_VERSION(), is not a macro.
SDL_version compiled;
SDL_version linked;
SDL_VERSION(&compiled);
SDL_GetVersion(&linked);"We compiled against SDL version %u.%u.%u ...\n",
SDL_Log(
compiled.major, compiled.minor, compiled.patch);"But we are linking against SDL version %u.%u.%u.\n",
SDL_Log( linked.major, linked.minor, linked.patch);